Sha256: 6c320c60d99124191685e9a228d25cc68488bfc123d202eb63e5e5425e4a0ce0

Contents?: true

Size: 723 Bytes

Versions: 1

Compression:

Stored size: 723 Bytes

Contents

require 'rubygems'
require 'hashie/mash'

module Buildbox
  class Build < Hashie::Mash
    class State
      STARTED  = 'started'
      FINISHED = 'finished'
    end

    class Part < Hashie::Mash
      def success?
        exit_status == 0
      end
    end

    attr_reader :parts

    def initialize(*args)
      super(*args)
      @parts = []
    end

    def success?
      !@parts.empty? && @parts.last.success?
    end

    def started?
      state == State::STARTED
    end

    def finished?
      state == State::FINISHED
    end

    def namespace
      raise "Missing project id" unless project.id
      raise "Missing team id" unless project.team.id

      "#{project.team.id}/#{project.id}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
buildbox-0.3.1 lib/buildbox/build.rb