Sha256: c0418293195875d65b1c19eeb15025bb2c9510af7a672d7711c5297671f9f055

Contents?: true

Size: 1.24 KB

Versions: 41

Compression:

Stored size: 1.24 KB

Contents

require "pact_broker/client/can_i_deploy"

module PactBroker
  module Client
    class VerificationRequired < PactBroker::Client::CanIDeploy
      def call
        create_result(fetch_matrix_with_retries)
      rescue StandardError => e
        message = "Error determining if a verification already existed (#{e.message}) - verification should run just in case"
        if options[:verbose]
          message = "#{message}\n#{e.class} - #{e.backtrace.join("\n")}"
        end
        Result.new(true, message)
      end

      private

      def create_result(matrix)
        matrix_and_notices = format_matrix(matrix) + "\n\n" + remove_warnings(Term::ANSIColor.uncolor(notice_or_reason(matrix, :white)))
        # If the specified version numbers do not exist, then all the counts come back 0. Can't just check for unknown to be 0.
        # This command needs to handle "I screwed up the query"
        if matrix.no_results?
          Result.new(true, matrix_and_notices + "\n\nVerification is required.")
        else
          Result.new(false, matrix_and_notices + "\n\nNo verification is required.")
        end
      end

      def remove_warnings(lines)
        lines.split("\n").select{ | line | !line.include?("WARN:") }.join("\n")
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
pact_broker-client-1.63.0 lib/pact_broker/client/verification_required.rb
pact_broker-client-1.62.1 lib/pact_broker/client/verification_required.rb
pact_broker-client-1.62.0 lib/pact_broker/client/verification_required.rb
pact_broker-client-1.61.1 lib/pact_broker/client/verification_required.rb
pact_broker-client-1.61.0 lib/pact_broker/client/verification_required.rb
pact_broker-client-1.60.0 lib/pact_broker/client/verification_required.rb
pact_broker-client-1.59.0 lib/pact_broker/client/verification_required.rb
pact_broker-client-1.58.0 lib/pact_broker/client/verification_required.rb
pact_broker-client-1.57.0 lib/pact_broker/client/verification_required.rb
pact_broker-client-1.56.0 lib/pact_broker/client/verification_required.rb
pact_broker-client-1.55.0 lib/pact_broker/client/verification_required.rb
pact_broker-client-1.54.0 lib/pact_broker/client/verification_required.rb
pact_broker-client-1.53.0 lib/pact_broker/client/verification_required.rb
pact_broker-client-1.52.0 lib/pact_broker/client/verification_required.rb
pact_broker-client-1.51.2 lib/pact_broker/client/verification_required.rb
pact_broker-client-1.51.1 lib/pact_broker/client/verification_required.rb
pact_broker-client-1.51.0 lib/pact_broker/client/verification_required.rb
pact_broker-client-1.50.0 lib/pact_broker/client/verification_required.rb
pact_broker-client-1.49.0 lib/pact_broker/client/verification_required.rb
pact_broker-client-1.48.0 lib/pact_broker/client/verification_required.rb