Class: Travis::Client::Job

Inherits:
Entity
  • Object
show all
Includes:
States
Defined in:
lib/travis/client/job.rb

Constant Summary

Constants included from States

States::STATES

Constants inherited from Entity

Entity::MAP

Instance Attribute Summary collapse

Attributes inherited from Entity

#attributes, #curry, #id, #session

Instance Method Summary collapse

Methods included from States

#canceled?, #color, #created?, #errored?, #failed?, #finished?, #green?, #passed?, #pending?, #queued?, #ready?, #red?, #running?, #started?, #unsuccessful?, #yellow?

Methods inherited from Entity

#[], #[]=, aka, #attribute_names, attributes, cast_id, #complete?, has, #include?, #initialize, #inspect, inspect_info, #load, many, #missing?, one, relations, #relations, #reload, subclass_for, subclasses, time, #update_attributes

Constructor Details

This class inherits a constructor from Travis::Client::Entity

Instance Attribute Details

#allow_failureObject (readonly) Also known as: allow_failure?

Returns the value of attribute allow_failure.



1
2
3
# File 'lib/travis/client/job.rb', line 1

def allow_failure
  @allow_failure
end

#buildObject (readonly)

Returns the value of attribute build.



1
2
3
# File 'lib/travis/client/job.rb', line 1

def build
  @build
end

#build_idObject (readonly)

Returns the value of attribute build_id.



1
2
3
# File 'lib/travis/client/job.rb', line 1

def build_id
  @build_id
end

#commitObject (readonly)

Returns the value of attribute commit.



1
2
3
# File 'lib/travis/client/job.rb', line 1

def commit
  @commit
end

#commit_idObject (readonly)

Returns the value of attribute commit_id.



1
2
3
# File 'lib/travis/client/job.rb', line 1

def commit_id
  @commit_id
end

#configObject (readonly)

Returns the value of attribute config.



1
2
3
# File 'lib/travis/client/job.rb', line 1

def config
  @config
end

#finished_atObject (readonly)

Returns the value of attribute finished_at.



1
2
3
# File 'lib/travis/client/job.rb', line 1

def finished_at
  @finished_at
end

#log_idObject (readonly)

Returns the value of attribute log_id.



1
2
3
# File 'lib/travis/client/job.rb', line 1

def log_id
  @log_id
end

#numberObject (readonly)

Returns the value of attribute number.



1
2
3
# File 'lib/travis/client/job.rb', line 1

def number
  @number
end

#queueObject (readonly)

Returns the value of attribute queue.



1
2
3
# File 'lib/travis/client/job.rb', line 1

def queue
  @queue
end

#repositoryObject (readonly)

Returns the value of attribute repository.



1
2
3
# File 'lib/travis/client/job.rb', line 1

def repository
  @repository
end

#repository_idObject (readonly)

Returns the value of attribute repository_id.



1
2
3
# File 'lib/travis/client/job.rb', line 1

def repository_id
  @repository_id
end

#started_atObject (readonly)

Returns the value of attribute started_at.



1
2
3
# File 'lib/travis/client/job.rb', line 1

def started_at
  @started_at
end

#stateObject (readonly)

Returns the value of attribute state.



1
2
3
# File 'lib/travis/client/job.rb', line 1

def state
  @state
end

#tagsObject (readonly)

Returns the value of attribute tags.



1
2
3
# File 'lib/travis/client/job.rb', line 1

def tags
  @tags
end

Instance Method Details

#allow_failures?Boolean

Returns:

  • (Boolean)


36
37
38
39
40
41
# File 'lib/travis/client/job.rb', line 36

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

#branch_infoObject



32
33
34
# File 'lib/travis/client/job.rb', line 32

def branch_info
  build.branch_info
end

#durationObject



43
44
45
46
47
48
49
# File 'lib/travis/client/job.rb', line 43

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

#inspect_infoObject



51
52
53
# File 'lib/travis/client/job.rb', line 51

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

#pull_request?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/travis/client/job.rb', line 24

def pull_request?
  build.pull_request?
end

#push?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/travis/client/job.rb', line 28

def push?
  build.push?
end

#restartObject



20
21
22
# File 'lib/travis/client/job.rb', line 20

def restart
  session.restart(self)
end