Class: Ace::Overseer::CLI::Commands::Prune
- Inherits:
-
Support::Cli::Command
- Object
- Support::Cli::Command
- Ace::Overseer::CLI::Commands::Prune
- Includes:
- Support::Cli::Base
- Defined in:
- lib/ace/overseer/cli/commands/prune.rb
Instance Method Summary collapse
- #call(**options) ⇒ Object
-
#initialize(orchestrator: nil, input: $stdin, output: $stdout, lab_client: nil) ⇒ Prune
constructor
A new instance of Prune.
Constructor Details
#initialize(orchestrator: nil, input: $stdin, output: $stdout, lab_client: nil) ⇒ Prune
Returns a new instance of Prune.
22 23 24 25 26 27 28 |
# File 'lib/ace/overseer/cli/commands/prune.rb', line 22 def initialize(orchestrator: nil, input: $stdin, output: $stdout, lab_client: nil) super() @orchestrator = orchestrator || Organisms::PruneOrchestrator.new @input = input @output = output @lab_client = lab_client || Molecules::LabClient.new end |
Instance Method Details
#call(**options) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/ace/overseer/cli/commands/prune.rb', line 30 def call(**) runtime = .fetch(:runtime, "tmux") if runtime == "lab" prune_lab(**) return end raise Ace::Support::Cli::Error, "unsupported runtime: #{runtime}" unless runtime == "tmux" Atoms::RepoGuard.ensure_repo! targets = Array([:targets] || []) progress = [:quiet] ? nil : ->(msg) { puts msg } result = @orchestrator.call( dry_run: [:dry_run], yes: [:yes], force: [:force], targets: targets, assignment_id: [:assignment], input: @input, output: @output, on_progress: progress ) return if [:quiet] if [:assignment] print_assignment_result(result) return end if result[:dry_run] print_dry_run(result) return end if result[:aborted] puts "Prune aborted." return end print_apply(result) rescue => e raise Ace::Support::Cli::Error.new(e.) end |