Class: Cody::Stop

Inherits:
Base
  • Object
show all
Defined in:
lib/cody/stop.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #run_with_exception_handling

Methods included from AwsServices

#cfn, #codebuild

Methods included from AwsServices::Helpers

#are_you_sure?, #inferred_project_name, #inferred_stack_name, #project_name_convention, #stack_exists?

Constructor Details

This class inherits a constructor from Cody::Base

Instance Method Details

#build_idObject



10
11
12
13
14
15
# File 'lib/cody/stop.rb', line 10

def build_id
  return @options[:build_id] if @options[:build_id]

  resp = codebuild.list_builds_for_project(project_name: @full_project_name)
  resp.ids.first # most recent build_id
end

#runObject



3
4
5
6
7
8
# File 'lib/cody/stop.rb', line 3

def run
  run_with_exception_handling do
    codebuild.stop_build(id: build_id)
    puts "Build has been stopped: #{build_id}"
  end
end