Class: Cody::Base

Inherits:
Object
  • Object
show all
Includes:
AwsServices
Defined in:
lib/cody/base.rb

Direct Known Subclasses

Logs, Stop

Instance Method Summary collapse

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

#initialize(options) ⇒ Base

Returns a new instance of Base.



6
7
8
9
10
# File 'lib/cody/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

#run_with_exception_handlingObject



12
13
14
15
16
17
18
19
# File 'lib/cody/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