Class: PactBroker::Matrix::ResolvedSelectorsBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/pact_broker/matrix/resolved_selectors_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResolvedSelectorsBuilder

Returns a new instance of ResolvedSelectorsBuilder.



11
12
13
# File 'lib/pact_broker/matrix/resolved_selectors_builder.rb', line 11

def initialize
  @inferred_selectors = []
end

Instance Attribute Details

#ignore_selectorsObject (readonly)

Returns the value of attribute ignore_selectors.



9
10
11
# File 'lib/pact_broker/matrix/resolved_selectors_builder.rb', line 9

def ignore_selectors
  @ignore_selectors
end

#inferred_selectorsObject (readonly)

Returns the value of attribute inferred_selectors.



9
10
11
# File 'lib/pact_broker/matrix/resolved_selectors_builder.rb', line 9

def inferred_selectors
  @inferred_selectors
end

#specified_selectorsObject (readonly)

Returns the value of attribute specified_selectors.



9
10
11
# File 'lib/pact_broker/matrix/resolved_selectors_builder.rb', line 9

def specified_selectors
  @specified_selectors
end

Instance Method Details

#all_selectorsArray<PactBroker::Matrix::ResolvedSelector>

All the resolved selectors to be used in the matrix query, specified and inferred (if any)



34
35
36
# File 'lib/pact_broker/matrix/resolved_selectors_builder.rb', line 34

def all_selectors
  specified_selectors + inferred_selectors
end

#resolve_inferred_selectors(integrations, options) ⇒ Object

Use the given Integrations to work out what the selectors are for the versions that the versions for the specified selectors should be deployed with. eg. For ‘can-i-deploy –pacticipant Foo –version adfjkwejr –to-environment prod`, work out the selectors for the integrated application versions in the prod environment.

Parameters:



28
29
30
# File 'lib/pact_broker/matrix/resolved_selectors_builder.rb', line 28

def resolve_inferred_selectors(integrations, options)
  @inferred_selectors = SelectorResolver.resolve_inferred_selectors(specified_selectors, ignore_selectors, integrations, options)
end

#resolve_selectors(unresolved_specified_selectors, unresolved_ignore_selectors) ⇒ Object

Parameters:



17
18
19
20
21
# File 'lib/pact_broker/matrix/resolved_selectors_builder.rb', line 17

def resolve_selectors(unresolved_specified_selectors, unresolved_ignore_selectors)
  # must do this first because we need the ignore selectors to resolve the specified selectors
  @ignore_selectors = SelectorResolver.resolved_ignore_selectors(unresolved_ignore_selectors)
  @specified_selectors = SelectorResolver.resolve_specified_selectors(unresolved_specified_selectors, ignore_selectors)
end