lib/r10k/cli/deploy.rb in r10k-1.3.5 vs lib/r10k/cli/deploy.rb in r10k-1.4.0

- old
+ new

@@ -3,10 +3,14 @@ require 'r10k/deployment/config' require 'r10k/task_runner' require 'r10k/task/deployment' +require 'r10k/action/cri_runner' +require 'r10k/action/deploy' + + require 'cri' module R10K::CLI module Deploy def self.command @@ -50,30 +54,14 @@ scheduled. On subsequent deployments, Puppetfile deployment will default to off. DESCRIPTION flag :p, :puppetfile, 'Deploy modules from a puppetfile' - run do |opts, args, cmd| - deploy = R10K::Deployment.load_config(opts[:config]) - - task = R10K::Task::Deployment::DeployEnvironments.new(deploy) - task.update_puppetfile = opts[:puppetfile] - task.environment_names = args - - purge = R10K::Task::Deployment::PurgeEnvironments.new(deploy) - - runner = R10K::TaskRunner.new(:trace => opts[:trace]) - runner.append_task task - runner.append_task purge - runner.run - - exit runner.exit_value - end + runner R10K::Action::CriRunner.wrap(R10K::Action::Deploy::Environment) end end end - self.command.add_command(Environment.command) module Module def self.command @cmd ||= Cri::Command.define do name 'module' @@ -86,51 +74,32 @@ try to deploy the given module names in all environments. DESCRIPTION required :e, :environment, 'Update the modules in the given environment' - run do |opts, args, cmd| - deploy = R10K::Deployment.load_config(opts[:config]) - - task = R10K::Task::Deployment::DeployModules.new(deploy) - task.module_names = args - task.environment_names = [opts[:environment]] if opts[:environment] - - runner = R10K::TaskRunner.new(:trace => opts[:trace]) - runner.append_task task - runner.run - - exit runner.exit_value - end + runner R10K::Action::CriRunner.wrap(R10K::Action::Deploy::Module) end end end - self.command.add_command(Module.command) module Display def self.command @cmd ||= Cri::Command.define do name 'display' + aliases 'list' usage 'display' summary 'Display environments and modules in the deployment' flag :p, :puppetfile, 'Display Puppetfile modules' + flag nil, :detail, 'Display detailed information' - run do |opts, args, cmd| - deploy = R10K::Deployment.load_config(opts[:config]) - - task = R10K::Task::Deployment::Display.new(deploy) - task.puppetfile = opts[:puppetfile] - - runner = R10K::TaskRunner.new(:trace => opts[:trace]) - runner.prepend_task task - runner.run - - exit runner.exit_value - end + runner R10K::Action::CriRunner.wrap(R10K::Action::Deploy::Display) end end end - self.command.add_command(Display.command) end - self.command.add_command(Deploy.command) end + +R10K::CLI.command.add_command(R10K::CLI::Deploy.command) +R10K::CLI::Deploy.command.add_command(R10K::CLI::Deploy::Environment.command) +R10K::CLI::Deploy.command.add_command(R10K::CLI::Deploy::Module.command) +R10K::CLI::Deploy.command.add_command(R10K::CLI::Deploy::Display.command)