Module: Build::Matrix

Extended by:
ActiveSupport::Concern
Included in:
Build
Defined in:
lib/travis/model/build/matrix.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

ENV_KEYS =
[:rvm, :gemfile, :env, :otp_release]

Instance Method Summary collapse

Instance Method Details

#matrix_finished?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/travis/model/build/matrix.rb', line 29

def matrix_finished?(*)
  matrix.all?(&:finished?)
end

#matrix_for(config) ⇒ Object

Return only the child builds whose config matches against as passed hash e.g. build.matrix_for(rvm: ‘1.8.7’, env: ‘DB=postgresql’)



25
26
27
# File 'lib/travis/model/build/matrix.rb', line 25

def matrix_for(config)
  config.blank? ? matrix : matrix.select { |job| job.matrix_config?(config) }
end

#matrix_status(config = {}) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/travis/model/build/matrix.rb', line 33

def matrix_status(config = {})
  tests = matrix_for(config)
  if tests.blank?
    nil
  elsif tests.all?(&:passed?)
    0
  elsif tests.any?(&:failed?)
    1
  else
    nil
  end
end