Class: Codebuild::Start
- Inherits:
-
Object
- Object
- Codebuild::Start
- Includes:
- AwsServices
- Defined in:
- lib/codebuild/start.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ Start
constructor
A new instance of Start.
- #project_name ⇒ Object
- #run ⇒ Object
Methods included from AwsServices
Methods included from AwsServices::Helpers
#are_you_sure?, #inferred_project_name, #inferred_stack_name, #project_name_convention, #stack_exists?
Constructor Details
#initialize(options) ⇒ Start
Returns a new instance of Start.
5 6 7 8 9 |
# File 'lib/codebuild/start.rb', line 5 def initialize() = @project_name = [:project_name] || inferred_project_name @full_project_name = project_name_convention(@project_name) end |
Instance Method Details
#project_name ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/codebuild/start.rb', line 23 def project_name if project_exists?(@full_project_name) @full_project_name elsif stack_exists?(@project_name) # allow `cb start STACK_NAME` to work too resp = cfn.describe_stack_resources(stack_name: @project_name) resource = resp.stack_resources.find do |r| r.logical_resource_id == "CodeBuild" end resource.physical_resource_id # codebuild project name else puts "ERROR: Unable to find the codebuild project with identifier #@identifier".color(:red) exit 1 end end |
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/codebuild/start.rb', line 11 def run source_version = [:branch] || [:source_version] || 'master' resp = codebuild.start_build( project_name: project_name, source_version: source_version ) puts "Build started for project: #{project_name}" puts "Please check the CodeBuild console for the status." puts "Codebuild Log Url:" puts codebuild_log_url(resp.build.id) end |