diff --git a/README.md b/README.md index 4ea342d..471cd38 100644 --- a/README.md +++ b/README.md @@ -59,10 +59,10 @@ Options: -h, [--branch=BRANCH] # Repository branch of the consumer version -r, [--auto-detect-version-properties], [--no-auto-detect-version-properties] - # Automatically detect the repository branch from known CI - environment variables or git CLI. Supports Buildkite, Circle - CI, Travis CI, GitHub Actions, Jenkins, Hudson, AppVeyor, - GitLab, CodeShip, Bitbucket and Azure DevOps. + # Automatically detect the repository commit and branch from + known CI environment variables or git CLI. Supports Buildkite, + Circle CI, Travis CI, GitHub Actions, Jenkins, Hudson, + AppVeyor, GitLab, CodeShip, Bitbucket and Azure DevOps. -t, [--tag=TAG] # Tag name for consumer version. Can be specified multiple times. @@ -497,8 +497,8 @@ Description: support for environments, deployments and releases. For documentation on how to use can-i-deploy with tags, please see https://docs.pact.io/pact_broker/client_cli/can_i_deploy_usage_with_tags/ - Before `can-i-deploy` can be used, the relevant environment resources must first be created in the Pact Broker using the `create-environment` command. The "test" - and "production" environments will have been seeded for you. You can check the existing environments by running `pact-broker list-environments`. See + Before `can-i-deploy` can be used, the relevant environment resources must first be created in the Pact Broker using the `create-environment` command. The + "test" and "production" environments will have been seeded for you. You can check the existing environments by running `pact-broker list-environments`. See https://docs.pact.io/pact_broker/client_cli/readme#environments for more information. $ pact-broker create-environment --name "uat" --display-name "UAT" --no-production @@ -508,8 +508,8 @@ Description: $ pact-broker record-deployment --pacticipant Foo --version 173153ae0 --environment uat - Before an application is deployed or released to an environment, the can-i-deploy command must be run to check that the application version is safe to deploy with - the versions of each integrated application that are already in that environment. + Before an application is deployed or released to an environment, the can-i-deploy command must be run to check that the application version is safe to deploy + with the versions of each integrated application that are already in that environment. $ pact-broker can-i-deploy --pacticipant PACTICIPANT --version VERSION --to-environment ENVIRONMENT @@ -517,8 +517,8 @@ Description: $ pact-broker can-i-deploy --pacticipant Foo --version 173153ae0 --to-environment test - Can-i-deploy can also be used to check if arbitrary versions have a successful verification. When asking "Can I deploy this application version with the latest version - from the main branch of another application" it functions as a "can I merge" check. + Can-i-deploy can also be used to check if arbitrary versions have a successful verification. When asking "Can I deploy this application version with the + latest version from the main branch of another application" it functions as a "can I merge" check. $ pact-broker can-i-deploy --pacticipant Foo 173153ae0 \ --pacticipant Bar --latest main @@ -671,8 +671,8 @@ Options: ``` Description: - Create a curl command that executes the request that you want your webhook to execute, then replace "curl" with "pact-broker create-webhook" and add the consumer, - provider, event types and broker details. Note that the URL must be the first parameter when executing create-webhook. + Create a curl command that executes the request that you want your webhook to execute, then replace "curl" with "pact-broker create-webhook" and add the + consumer, provider, event types and broker details. Note that the URL must be the first parameter when executing create-webhook. Note that the -u option from the curl command clashes with the -u option from the pact-broker CLI. When used in this command, the -u will be used as a curl option. Please use the --broker-username or environment variable for the Pact Broker username. @@ -736,9 +736,9 @@ Options: ``` Description: - Create a curl command that executes the request that you want your webhook to execute, then replace "curl" with "pact-broker create-or-update-webhook" and add the - consumer, provider, event types and broker details. Note that the URL must be the first parameter when executing create-or-update-webhook and a uuid must - also be provided. You can generate a valid UUID by using the `generate-uuid` command. + Create a curl command that executes the request that you want your webhook to execute, then replace "curl" with "pact-broker create-or-update-webhook" and + add the consumer, provider, event types and broker details. Note that the URL must be the first parameter when executing create-or-update-webhook and a uuid + must also be provided. You can generate a valid UUID by using the `generate-uuid` command. Note that the -u option from the curl command clashes with the -u option from the pact-broker CLI. When used in this command, the -u will be used as a curl option. Please use the --broker-username or environment variable for the Pact Broker username. diff --git a/doc/pacts/markdown/Pact Broker Client - Pactflow.md b/doc/pacts/markdown/Pact Broker Client - Pactflow.md index e092e37..cd96012 100644 --- a/doc/pacts/markdown/Pact Broker Client - Pactflow.md +++ b/doc/pacts/markdown/Pact Broker Client - Pactflow.md @@ -104,7 +104,7 @@ Given **there is a pf:ui href in the response**, upon receiving **a request to c } } ``` -Pactflow will respond with: +PactFlow will respond with: ```json { "status": 201, diff --git a/doc/pacts/markdown/README.md b/doc/pacts/markdown/README.md index 5ba4433..4c45249 100644 --- a/doc/pacts/markdown/README.md +++ b/doc/pacts/markdown/README.md @@ -1,4 +1,4 @@ ### Pacts for Pact Broker Client * [Pact Broker](Pact%20Broker%20Client%20-%20Pact%20Broker.md) -* [PactFlow](Pact%20Broker%20Client%20-%20Pactflow.md) +* [PactFlow](Pact%20Broker%20Client%20-%20PactFlow.md) diff --git a/lib/pact_broker/client/cli/pact_commands.rb b/lib/pact_broker/client/cli/pact_commands.rb index 0c30300..81a8ee9 100644 --- a/lib/pact_broker/client/cli/pact_commands.rb +++ b/lib/pact_broker/client/cli/pact_commands.rb @@ -14,9 +14,9 @@ module PactCommands def self.included(thor) thor.class_eval do desc 'publish PACT_DIRS_OR_FILES ...', "Publish pacts to a Pact Broker." - method_option :consumer_app_version, aliases: "-a", desc: "The consumer application version", default: '' + method_option :consumer_app_version, aliases: "-a", desc: "The consumer application version" method_option :branch, aliases: "-h", desc: "Repository branch of the consumer version" - method_option :auto_detect_version_properties, aliases: "-r", type: :boolean, default: false, desc: "Automatically detect the repository branch from known CI environment variables or git CLI. Supports Buildkite, Circle CI, Travis CI, GitHub Actions, Jenkins, Hudson, AppVeyor, GitLab, CodeShip, Bitbucket and Azure DevOps." + method_option :auto_detect_version_properties, aliases: "-r", type: :boolean, default: false, desc: "Automatically detect the repository commit and branch from known CI environment variables or git CLI. Supports Buildkite, Circle CI, Travis CI, GitHub Actions, Jenkins, Hudson, AppVeyor, GitLab, CodeShip, Bitbucket and Azure DevOps." method_option :tag, aliases: "-t", type: :array, banner: "TAG", desc: "Tag name for consumer version. Can be specified multiple times." method_option :tag_with_git_branch, aliases: "-g", type: :boolean, default: false, required: false, desc: "Tag consumer version with the name of the current git branch. Supports Buildkite, Circle CI, Travis CI, GitHub Actions, Jenkins, Hudson, AppVeyor, GitLab, CodeShip, Bitbucket and Azure DevOps. Default: false" method_option :build_url, desc: "The build URL that created the pact" @@ -122,8 +122,6 @@ def consumer_app_version require 'pact_broker/client/git' if options.consumer_app_version.blank? && options.auto_detect_version_properties PactBroker::Client::Git.commit(raise_error: explict_auto_detect_version_properties) - elsif (options.consumer_app_version.nil? || options.consumer_app_version == '' || options.consumer_app_version == 'consumer_app_version') && !options.auto_detect_version_properties - raise Thor::Error.new("ERROR: --consumer-app-version was not provided a value and --auto-detect-version-properties not set") else options.consumer_app_version end diff --git a/lib/pact_broker/client/git.rb b/lib/pact_broker/client/git.rb index 7c5744f..4354a49 100644 --- a/lib/pact_broker/client/git.rb +++ b/lib/pact_broker/client/git.rb @@ -104,7 +104,7 @@ def self.execute_git_commit_command(raise_error) raise PactBroker::Client::Error, "Could not determine current git commit using command `#{COMMIT_COMMAND}`. #{e.class} #{e.message}" else - return nil + return [] end end diff --git a/lib/pact_broker/client/tasks/publication_task.rb b/lib/pact_broker/client/tasks/publication_task.rb index 6f194bd..bd24544 100644 --- a/lib/pact_broker/client/tasks/publication_task.rb +++ b/lib/pact_broker/client/tasks/publication_task.rb @@ -45,7 +45,7 @@ def branch= branch end def consumer_version=(consumer_version) - @version_required = version_required || !!consumer_version + @version_required = !!consumer_version @consumer_version = consumer_version end diff --git a/spec/lib/pact_broker/client/cli/broker_publish_spec.rb b/spec/lib/pact_broker/client/cli/broker_publish_spec.rb index 6eac2a5..00c132f 100644 --- a/spec/lib/pact_broker/client/cli/broker_publish_spec.rb +++ b/spec/lib/pact_broker/client/cli/broker_publish_spec.rb @@ -163,7 +163,7 @@ module PactBroker::Client::CLI context "with --auto-detect-version-properties on by default" do before do subject.options = OpenStruct.new( - minimum_valid_options.merge(auto_detect_version_properties: true, consumer_app_version: '') + minimum_valid_options.merge(auto_detect_version_properties: true, consumer_app_version: nil) ) allow(subject).to receive(:explict_auto_detect_version_properties).and_return(false) end @@ -203,7 +203,7 @@ module PactBroker::Client::CLI context "with --auto-detect-version-properties specified explicitly" do before do subject.options = OpenStruct.new( - minimum_valid_options.merge(auto_detect_version_properties: true, consumer_app_version: '') + minimum_valid_options.merge(auto_detect_version_properties: true, consumer_app_version: nil) ) allow(subject).to receive(:explict_auto_detect_version_properties).and_return(true) end