lib/papa/task/integration/start.rb in papa-0.5.0 vs lib/papa/task/integration/start.rb in papa-0.6.0
- old
+ new
@@ -5,50 +5,19 @@
module Papa
module Task
module Integration
class Start < Common::Start
- def initialize(base_branch:, hostname:, skip_larga:)
+ def initialize(base_branch, options = {})
@build_type = 'integration'
@base_branch = base_branch
- @hostname = hostname
- @skip_larga = skip_larga
- @build_branch = generate_integration_branch_name
+ @build_branch = "#{@build_type}/#{options[:override_branch_name] || generate_integration_timestamp}"
end
- def run
- super
- return if @skip_larga
- deploy_options = {
- branch: @build_branch,
- hostname: @hostname
- }
- queue = [
- Command::Larga::Type.new,
- Command::Larga::Deploy.new(deploy_options)
- ]
- runner = Runner.new(queue)
-
- if runner.run
- success_message_integration
- else
- failure_message_integration
- exit 1
- end
- end
-
private
- def generate_integration_branch_name
- "integration/#{DateTime.now.strftime('%y.%m.%d.%H.%M.%S').gsub('.0', '.')}"
- end
-
- def success_message_integration
- Helper::Output.success 'Successfully deployed larga instance.'
- end
-
- def failure_message_integration
- Helper::Output.failure 'There was a problem deploying larga instance.'
+ def generate_integration_timestamp
+ DateTime.now.strftime('%y.%m.%d.%H.%M.%S').gsub('.0', '.')
end
end
end
end
end