Sha256: 1db368427383c6ffba80cb3446827230ab42303f8bcea9da604fbeb3f0763c94

Contents?: true

Size: 869 Bytes

Versions: 9

Compression:

Stored size: 869 Bytes

Contents

# Base only for Stop and Start currently.
module Cody
  class Base
    include AwsServices

    def initialize(options)
      @options = options
      @project_name = options[:project_name] || inferred_project_name
      @full_project_name = project_name_convention(@project_name)
    end

    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

    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
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cody-0.9.8 lib/cody/base.rb
cody-0.9.7 lib/cody/base.rb
cody-0.9.6 lib/cody/base.rb
cody-0.9.5 lib/cody/base.rb
cody-0.9.4 lib/cody/base.rb
cody-0.9.3 lib/cody/base.rb
cody-0.9.2 lib/cody/base.rb
cody-0.9.1 lib/cody/base.rb
cody-0.9.0 lib/cody/base.rb