Sha256: bac95f0cbade31c6fd4444e07f5aada0908f0454822ecb9051572b964e8817b1

Contents?: true

Size: 787 Bytes

Versions: 2

Compression:

Stored size: 787 Bytes

Contents

# Wrap project in object to allow lazy loading of status
class 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

2 entries across 2 versions & 1 rubygems

Version Path
cody-0.9.8 lib/cody/list/project.rb
cody-0.9.7 lib/cody/list/project.rb