Sha256: ca66b6297f2a6a2336f2046b07f1af9dc700a09323e2410c4b633f2efa8d33e3

Contents?: true

Size: 1.77 KB

Versions: 9

Compression:

Stored size: 1.77 KB

Contents

require "pact_broker/matrix/selector_resolver"

# Builds the array of ResolvedSelector objects using the
# ignore selectors, the specified selectors, and the inferred integrations.

module PactBroker
  module Matrix
    class ResolvedSelectorsBuilder
      attr_reader :ignore_selectors, :specified_selectors, :inferred_selectors

      def initialize
        @inferred_selectors = []
      end

      # @param [Array<PactBroker::Matrix::UnresolvedSelector>]
      # @param [Hash] options
      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

      # 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.
      # @param [Array<PactBroker::Matrix::Integration>] integrations
      def resolve_inferred_selectors(integrations, options)
        @inferred_selectors = SelectorResolver.resolve_inferred_selectors(specified_selectors, ignore_selectors, integrations, options)
      end

      # All the resolved selectors to be used in the matrix query, specified and inferred (if any)
      # @return [Array<PactBroker::Matrix::ResolvedSelector>]
      def all_selectors
        specified_selectors + inferred_selectors
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pact_broker-2.114.0 lib/pact_broker/matrix/resolved_selectors_builder.rb
pact_broker-2.113.2 lib/pact_broker/matrix/resolved_selectors_builder.rb
pact_broker-2.113.1 lib/pact_broker/matrix/resolved_selectors_builder.rb
pact_broker-2.113.0 lib/pact_broker/matrix/resolved_selectors_builder.rb
pact_broker-2.112.0 lib/pact_broker/matrix/resolved_selectors_builder.rb
pact_broker-2.111.0 lib/pact_broker/matrix/resolved_selectors_builder.rb
pact_broker-2.109.1 lib/pact_broker/matrix/resolved_selectors_builder.rb
pact_broker-2.109.0 lib/pact_broker/matrix/resolved_selectors_builder.rb
pact_broker-2.108.0 lib/pact_broker/matrix/resolved_selectors_builder.rb