Class: Cody::CLI::Base
Instance Method Summary
collapse
#cfn, #codebuild
#are_you_sure?, #find_stack, #inferred_project_name, #inferred_stack_name, #normalize_stack_name, #project_name_convention, #stack_exists?
Constructor Details
#initialize(options) ⇒ Base
Returns a new instance of Base.
6
7
8
9
10
|
# File 'lib/cody/cli/base.rb', line 6
def initialize(options)
@options = options
@project_name = options[:project_name] || inferred_project_name
@full_project_name = project_name_convention(@project_name)
end
|
Instance Method Details
#build_id ⇒ Object
21
22
23
24
25
26
|
# File 'lib/cody/cli/base.rb', line 21
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 end
|
#check_build_id! ⇒ Object
28
29
30
31
32
|
# File 'lib/cody/cli/base.rb', line 28
def check_build_id!
return if build_id
puts "WARN: No builds found for #{@project_name.color(:green)} project"
exit
end
|
#run_with_exception_handling ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/cody/cli/base.rb', line 12
def run_with_exception_handling
yield
rescue Aws::CodeBuild::Errors::ResourceNotFoundException => e
puts "ERROR: #{e.class}: #{e.message}".color(:red)
puts "CodeBuild project #{@full_project_name} not found."
rescue Aws::CodeBuild::Errors::InvalidInputException => e
puts "ERROR: #{e.class}: #{e.message}".color(:red)
end
|