Sha256: 5dce1844c93283e1c266fabe0593f9619ae9eb52de45746d3076cea7a0ba2301

Contents?: true

Size: 1.41 KB

Versions: 63

Compression:

Stored size: 1.41 KB

Contents

require 'travis/client'

module Travis
  module Client
    class Job < Entity
      include States, Restartable

      # @!parse attr_reader :repository_id, :build_id, :commit_id, :log_id, :number, :config, :state, :started_at, :finished_at, :queue, :allow_failure, :tags
      attributes :repository_id, :build_id, :commit_id, :log_id, :number, :config, :state, :started_at, :finished_at, :queue, :allow_failure, :tags
      time :started_at, :finished_at

      alias allow_failure? allow_failure

      # @!parse attr_reader :commit, :repository, :build
      has :commit, :repository, :build, :log

      one :job
      many :jobs

      def pull_request?
        build.pull_request?
      end

      def push?
        build.push?
      end

      def branch_info
        build.branch_info
      end

      def allow_failures?
        return false unless config.include? 'matrix' and config['matrix'].include? 'allow_failures'
        config['matrix']['allow_failures'].any? do |allow|
          allow.all? { |key, value| config[key] == value }
        end
      end

      def duration
        attributes['duration'] ||= begin
          start  = started_at  || Time.now
          finish = finished_at || Time.now
          (finish - start).to_i
        end
      end

      def pusher_channels
        build.pusher_channels + ["job-#{id}"]
      end

      def inspect_info
        "#{repository.slug}##{number}"
      end
    end
  end
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
travis-1.6.2.travis.365.4 lib/travis/client/job.rb
travis-1.6.2.travis.364.4 lib/travis/client/job.rb
travis-1.6.1 lib/travis/client/job.rb
travis-1.6.1.travis.363.4 lib/travis/client/job.rb
travis-1.6.0 lib/travis/client/job.rb
travis-1.5.9.travis.362.4 lib/travis/client/job.rb
travis-1.5.9.travis.361.4 lib/travis/client/job.rb
travis-1.5.9.travis.360.4 lib/travis/client/job.rb
travis-1.5.9.travis.358.4 lib/travis/client/job.rb
travis-1.5.8 lib/travis/client/job.rb
travis-1.5.8.travis.356.4 lib/travis/client/job.rb
travis-1.5.7 lib/travis/client/job.rb
travis-1.5.7.travis.345.4 lib/travis/client/job.rb
travis-1.5.7.travis.341.4 lib/travis/client/job.rb
travis-1.5.7.travis.338.4 lib/travis/client/job.rb
travis-1.5.6 lib/travis/client/job.rb
travis-1.5.6.travis.337.4 lib/travis/client/job.rb
travis-1.5.6.travis.336.4 lib/travis/client/job.rb
travis-1.5.6.travis.333.4 lib/travis/client/job.rb
travis-1.5.6.travis.332.4 lib/travis/client/job.rb