Class: EPC::Command::ShowDeploymentCommand
- Inherits:
-
ShowCommand
- Object
- BaseCommand
- ShowCommand
- EPC::Command::ShowDeploymentCommand
- Defined in:
- lib/epc/command/deployment/show_deployment_command.rb
Constant Summary
Constants inherited from BaseCommand
BaseCommand::GIVEUP_TICKS, BaseCommand::SLEEP_TIME, BaseCommand::TICKER_TICKS
Instance Attribute Summary
Attributes inherited from BaseCommand
#client, #klass_name, #object_id, #object_type, #options, #target_id, #target_type
Instance Method Summary collapse
Methods inherited from BaseCommand
#check_options, #context_params, #context_params=, #go, include_module, inherited, #initialize, required_options, #say_err
Methods included from PersistentAttributes
#auth_token, #caller_id, #target_url
Constructor Details
This class inherits a constructor from EPC::Command::BaseCommand
Instance Method Details
#execute(args) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 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 |
# File 'lib/epc/command/deployment/show_deployment_command.rb', line 5 def execute(args) status, response, headers = client.get(EPC::Config::DEPLOYMENTS_PATH + "/#{object_id}?include=solution,deployment_stage,approvals,deployer,submitter") if status.failure? say_err("Request failed: [#{response[:message]}]") return status end @showables = args.map(&:to_sym) rescue [] response[:created_at] = Time.parse(response[:created_at]).strftime("%m/%d/%Y %I:%M%p") unless response[:created_at].nil? response[:updated_at] = Time.parse(response[:updated_at]).strftime("%m/%d/%Y %I:%M%p") unless response[:updated_at].nil? response[:stage] = response[:deployment_stage][:name] response[:solution_id] = response[:solution][:id] response[:solution_name] = response[:solution][:name] response[:submitter] = response[:submitter][:name] rescue nil response[:deployer] = response[:deployer][:name] rescue nil @response = response if @showables.blank? deployments_table = EPC::TabularOutputter.new([response], [:id, :status, :stage, :solution_name, :submitter, :deployer, :updated_at, :note, :replaces]) say(deployments_table.print) end if show? :approvals say("\nApprovals:") approvals_table = EPC::TabularOutputter.new(response[:approvals], [:id, :name, :approved, :approver_id, :approver_name]) say(approvals_table.print) end if @showables.include?(:projects) || @showables.blank? projects = response[:solution][:projects] unless projects.nil? || projects.empty? say("\n\nProjects details:") projects.each do |project| say("\n## #{project[:name]}") project[:uri] = project[:uris].first unless project[:uris].nil? projects_table = EPC::TabularOutputter.new([project], [:id, :name, :version, :status, :uri, :instances, :deployed_project_id]) say(projects_table.print) config_values = project[:config_values] unless config_values.nil? || config_values.empty? say("\nConfig values: ") config_values_table = EPC::TabularOutputter.new(config_values, [:name, :value]) say(config_values_table.print) end say("\n\n") end end end return status end |