Sha256: 54481d7176e5607554a6ba439370db5c436b725890b3bb643a03e3aff951fa8c

Contents?: true

Size: 1.26 KB

Versions: 6

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

require 'travis/client'

module Travis
  module Client
    class Build < Entity
      include Restartable
      include States
      preloadable

      # @!parse attr_reader :repository_id, :commit_id, :number, :pull_request, :pull_request_number, :pull_request_title, :config, :state, :started_at, :finished_at, :duration, :job_ids
      attributes :repository_id, :commit_id, :number, :pull_request, :pull_request_number, :pull_request_title,
                 :config, :state, :started_at, :finished_at, :duration, :job_ids
      time :started_at, :finished_at

      alias pull_request? pull_request
      alias pr_number pull_request_number

      # @!parse attr_reader :repository, :commit, :jobs
      has :repository, :commit, :jobs

      one :build
      many :builds
      aka :branch, :branches

      def delete_logs(reason = {})
        jobs.each do |job|
          job.delete_log(reason)
        end
      end

      def push?
        !pull_request?
      end

      def branch_info
        info = commit.branch
        pull_request? ? info + " (PR ##{pr_number})" : info
      end

      def pusher_channels
        repository.pusher_channels
      end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
travis-1.14.0 lib/travis/client/build.rb
travis-1.13.3 lib/travis/client/build.rb
travis-1.13.2 lib/travis/client/build.rb
travis-1.13.1 lib/travis/client/build.rb
travis-1.13.0 lib/travis/client/build.rb
travis-1.12.0 lib/travis/client/build.rb