tasks/stack/stack.thor in docker-sync-0.0.11 vs tasks/stack/stack.thor in docker-sync-0.0.12

- old
+ new

@@ -1,15 +1,12 @@ -require 'docker_sync/sync_manager' -require 'config' -require 'preconditions' -require 'update_check' -require 'compose' - +require 'docker-sync/sync_manager' +require 'docker-sync/config' +require 'docker-sync/preconditions' +require 'docker-sync/update_check' +require 'docker/compose' +require 'docker-sync/compose' class Stack < Thor - include DockerSyncConfig - include Preconditions - class_option :config, :aliases => '-c', :default => nil, :type => :string, :desc => 'Path of the docker_sync config' class_option :sync_name, :aliases => '-n', :type => :string, :desc => 'If given, only this sync configuration will be references/started/synced' desc 'start', 'Start sync services, watcher and then your docker-compose defined stack' @@ -17,32 +14,32 @@ # do run update check in the start command only updates = UpdateChecker.new updates.run begin - check_all_preconditions + Preconditions::check_all_preconditions rescue Exception => e say_status 'error', e.message, :red exit 1 end if options[:config] config_path = options[:config] else begin - config_path = find_config + config_path = DockerSyncConfig::project_config_path rescue Exception => e say_status 'error', e.message, :red return end end @sync_manager = Docker_Rsync::SyncManager.new(:config_path => config_path) @sync_manager.run(options[:sync_name]) + global_options = @sync_manager.global_options + @compose_manager = ComposeManager.new(global_options) - @compose_manager = ComposeManager.new - compose_thread = Thread.new { @compose_manager.run } begin @@ -63,30 +60,33 @@ desc 'clean', 'compose down your app stack, stop and clean up all sync endpoints' def clean begin - check_all_preconditions + Preconditions::check_all_preconditions rescue Exception => e say_status 'error', e.message, :red exit 1 end if options[:config] config_path = options[:config] else begin - config_path = find_config + config_path = DockerSyncConfig::project_config_path rescue Exception => e say_status 'error', e.message, :red return end end - @compose_manager = ComposeManager.new + @sync_manager = Docker_Rsync::SyncManager.new(:config_path => config_path) + global_options = @sync_manager.global_options + # shutdown compose first + @compose_manager = ComposeManager.new(global_options) @compose_manager.clean say_status 'success', 'Finished cleaning up your app stack', :green - @sync_manager = Docker_Rsync::SyncManager.new(:config_path => config_path) + # now shutdown sync @sync_manager.clean(options[:sync_name]) say_status 'success', 'Finished cleanup. Removed stopped, removed sync container and removed there volumes', :green end end