Class: EPC::Command::CreateDeploymentCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- EPC::Command::CreateDeploymentCommand
- Defined in:
- lib/epc/command/deployment/create_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
Instance Method Summary collapse
Methods inherited from BaseCommand
#go, inherited, #initialize, required_options
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(*params) ⇒ Object
3 4 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 |
# File 'lib/epc/command/deployment/create_deployment_command.rb', line 3 def execute(*params) target_type, target_id = params[0].split(":") rescue [nil, nil] stage_name = params[1] path = File.(".") stage_name = "Development" if stage_name.nil? solution_name = @options[:solution_name] solution_id, solution_name = infer_solution_context(target_id, path, {:get_solution_name => true}) raise FatalError, "Solution name could not be inferred from directory structure. Either run this command from a solution directory, or specify the solution name with the -s option." if solution_name.nil? proceed = ask_yn("You are creating a deployment for the [#{solution_name}] solution with the [#{stage_name}] stage. Correct? [Yn]: ") if proceed.upcase == 'N' return 1 end versions, instances = {}, {} versions, instances = parse_projects(@options[:project_name]) unless blank?(@options[:project_name]) begin status, @id = create_deployment(solution_name, stage_name, versions, instances) return status unless status.successful? rescue Exception => ex say("Create deployment failed [Exception Caught (#{ex.class.name}): #{ex.to_s}].") return 1 end if @options[:replaces].present? status, response, headers = client.put(EPC::Config::DEPLOYMENTS_PATH + "/#{@id}", {:stage_name => "no_change", :replaces_id => @options[:replaces], :versions => "no_change"}) if status.failure? say("Replacement request failed: [#{response[:message]}]") else say("Replacement request successful") end return status end end |
#execute_internal(stage_name = nil) ⇒ Object
46 47 48 49 |
# File 'lib/epc/command/deployment/create_deployment_command.rb', line 46 def execute_internal(stage_name = nil) execute(stage_name) return @id end |