Class: RakeTasksDockerSync::Services
- Inherits:
-
RakeTasksDocker::Services
- Object
- RakeTasksDocker::Services
- RakeTasksDockerSync::Services
- Defined in:
- lib/rake-tasks-docker-sync/services.rb
Class Method Summary collapse
Instance Method Summary collapse
- #down ⇒ Object
- #exec(user, command) ⇒ Object
-
#initialize(syncs) ⇒ Services
constructor
A new instance of Services.
- #stop ⇒ Object
- #up ⇒ Object
Constructor Details
#initialize(syncs) ⇒ Services
Returns a new instance of Services.
14 15 16 |
# File 'lib/rake-tasks-docker-sync/services.rb', line 14 def initialize(syncs) @services = syncs end |
Class Method Details
.from_args(_args) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/rake-tasks-docker-sync/services.rb', line 6 def self.from_args(_args) raise 'No docker-sync.yml configuration found in your path' unless File.exist?('docker-sync.yml') docker_sync_config = YAML.load_file('docker-sync.yml') self.new(docker_sync_config['syncs'].keys) end |
Instance Method Details
#down ⇒ Object
26 27 28 |
# File 'lib/rake-tasks-docker-sync/services.rb', line 26 def down system 'docker-sync', 'clean' end |
#exec(user, command) ⇒ Object
30 31 32 33 34 |
# File 'lib/rake-tasks-docker-sync/services.rb', line 30 def exec(user, command) @services.each do |service| system 'docker', 'exec', '--user', user, service, command end end |
#stop ⇒ Object
22 23 24 |
# File 'lib/rake-tasks-docker-sync/services.rb', line 22 def stop system 'docker-sync', 'stop' end |
#up ⇒ Object
18 19 20 |
# File 'lib/rake-tasks-docker-sync/services.rb', line 18 def up system 'docker-sync', 'start' end |