Sha256: 2086b062a304905bf8bfc9f2af28620f9cf04c3c1d5f6bfadb91b7b7cec120fa

Contents?: true

Size: 788 Bytes

Versions: 9

Compression:

Stored size: 788 Bytes

Contents

# Wrap project in object to allow lazy loading of status
module Cody::List
  class Project
    include Cody::AwsServices
    extend Memoist

    delegate :build_status, :start_time, :end_time, to: :build
    alias_method :time, :end_time
    alias_method :status, :build_status

    attr_reader :name
    def initialize(name)
      @name = name # Simple string
    end

    def build
      return NoBuildsProject.new unless build_id # most recent build
      resp = codebuild.batch_get_builds(ids: [build_id])
      resp.builds.first
    end
    memoize :build
    alias_method :load, :build # interface to eager load

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

Version data entries

9 entries across 9 versions & 1 rubygems

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