Class: Ci::BuildDependencies

Inherits:
Object
  • Object
show all
Defined in:
app/models/ci/build_dependencies.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(processable) ⇒ BuildDependencies

Returns a new instance of BuildDependencies.


7
8
9
# File 'app/models/ci/build_dependencies.rb', line 7

def initialize(processable)
  @processable = processable
end

Instance Attribute Details

#processableObject (readonly)

Returns the value of attribute processable


5
6
7
# File 'app/models/ci/build_dependencies.rb', line 5

def processable
  @processable
end

Instance Method Details

#allObject


11
12
13
# File 'app/models/ci/build_dependencies.rb', line 11

def all
  (local + cross_pipeline).uniq
end

#cross_pipelineObject

Dependencies that are defined in other pipelines


27
28
29
# File 'app/models/ci/build_dependencies.rb', line 27

def cross_pipeline
  []
end

#invalid_localObject


31
32
33
# File 'app/models/ci/build_dependencies.rb', line 31

def invalid_local
  local.reject(&:valid_dependency?)
end

#localObject

Dependencies local to the given pipeline


16
17
18
19
20
21
22
23
24
# File 'app/models/ci/build_dependencies.rb', line 16

def local
  return [] if no_local_dependencies_specified?

  deps = model_class.where(pipeline_id: processable.pipeline_id).latest
  deps = from_previous_stages(deps)
  deps = from_needs(deps)
  deps = from_dependencies(deps)
  deps
end

#valid?Boolean

Returns:

  • (Boolean)

35
36
37
# File 'app/models/ci/build_dependencies.rb', line 35

def valid?
  valid_local? && valid_cross_pipeline?
end