Class: ComposeManager
- Inherits:
-
Object
- Object
- ComposeManager
- Includes:
- Thor::Shell
- Defined in:
- lib/docker-sync/compose.rb
Instance Method Summary collapse
- #clean ⇒ Object
-
#initialize(global_options) ⇒ ComposeManager
constructor
A new instance of ComposeManager.
- #run ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(global_options) ⇒ ComposeManager
Returns a new instance of ComposeManager.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/docker-sync/compose.rb', line 7 def initialize() @global_options = compose_file_path = 'docker-compose.yml' if @global_options.key?('compose-file-path') path = File.(@global_options['compose-file-path']) unless File.exist?(path) raise("Your referenced docker-compose file in docker-sync.yml was not found at #{@global_options['compose-file-path']}") end compose_file_path = @global_options['compose-file-path'] end @compose_session = Docker::Compose::Session.new(dir:'./', :file => compose_file_path) end |
Instance Method Details
#clean ⇒ Object
30 31 32 |
# File 'lib/docker-sync/compose.rb', line 30 def clean @compose_session.down end |
#run ⇒ Object
20 21 22 23 24 |
# File 'lib/docker-sync/compose.rb', line 20 def run say_status 'ok','starting compose',:white @compose_session.up say_status 'success','started compose',:green end |
#stop ⇒ Object
26 27 28 |
# File 'lib/docker-sync/compose.rb', line 26 def stop @compose_session.stop end |