Skip to content

Commit

Permalink
chore: review feedback - use StringRefinements, revert unness changes
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F committed Sep 14, 2023
1 parent 4144dae commit cf660f5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ test/version_tmp
tmp
reports
/.idea
DS_Store

# YARD artifacts
.yardoc
Expand Down
9 changes: 4 additions & 5 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# Developing

## Testing pact_broker-client locally

## Testing pact_broker locally

1. Make sure you have `ruby` available on the command line
1. Make sure you have `ruby` available on the command line
2. Install with `bundle install`
3. Run tests with `bundle exec rake`
4. Run individual test with `rspec <path to test>`
5. Run one of the scripts in `./example/scripts`, see the readme for more detail, and scripts

## Available Rake tasks
##  Available Rake tasks

1. check `bundle exec rake --tasks`

## Generating docs

If you change the CLI commands, run `bundle exec script/update-cli-usage-in-readme.rb` to update the `README.md` automatically.
If you change the CLI commands, run `bundle exec script/update-cli-usage-in-readme.rb` to update the `README.md` automatically.
6 changes: 3 additions & 3 deletions lib/pact_broker/client/cli/pact_commands.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require "pact_broker/client/hash_refinements"
require 'pact_broker/client/string_refinements'

module PactBroker
module Client
Expand All @@ -8,6 +9,7 @@ class PactPublicationError < ::Thor::Error; end

module PactCommands
using PactBroker::Client::HashRefinements
using PactBroker::Client::StringRefinements

def self.included(thor)
thor.class_eval do
Expand Down Expand Up @@ -118,9 +120,7 @@ def branch

def consumer_app_version
require 'pact_broker/client/git'
# if I pass the flag `--consumer-app-version ` then options.consumer_app_version == 'consumer_app_version')
# This stops a user passing the value consumer_app_version if they provide the flag but no value. If they provide the value "", it also now fails
if (options.consumer_app_version.nil? || options.consumer_app_version == '' || options.consumer_app_version == 'consumer_app_version') && options.auto_detect_version_properties
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")
Expand Down
3 changes: 1 addition & 2 deletions lib/pact_broker/client/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
require 'pact_broker/client/hash_refinements'

=begin
BUILDKITE_BRANCH BUILDKITE_COMMIT https://buildkite.com/docs/pipelines/environment-variables
CIRCLE_BRANCH CIRCLE_SHA1 https://circleci.com/docs/2.0/env-vars/
TRAVIS_COMMIT TRAVIS_BRANCH - TRAVIS_PULL_REQUEST_BRANCH TRAVIS_PULL_REQUEST_SHA https://docs.travis-ci.com/user/environment-variables/
Expand Down Expand Up @@ -105,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 []
return nil
end
end

Expand Down

0 comments on commit cf660f5

Please sign in to comment.