Sha256: 15f622e11382a7514382a6d24ddb62b7853d2f13cad68ac3c4c406f13811d9e8

Contents?: true

Size: 1 KB

Versions: 9

Compression:

Stored size: 1 KB

Contents

# Base only for Stop and Start currently.
class Cody::CLI
  class Base
    include Cody::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

    def check_build_id!
      return if build_id
      puts "WARN: No builds found for #{@project_name.color(:green)} project"
      exit
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cody-1.2.1 lib/cody/cli/base.rb
cody-1.1.0 lib/cody/cli/base.rb
cody-1.0.6 lib/cody/cli/base.rb
cody-1.0.5 lib/cody/cli/base.rb
cody-1.0.4 lib/cody/cli/base.rb
cody-1.0.3 lib/cody/cli/base.rb
cody-1.0.2 lib/cody/cli/base.rb
cody-1.0.1 lib/cody/cli/base.rb
cody-1.0.0 lib/cody/cli/base.rb