Skip to content

Commit

Permalink
feat(gems): upgrade pact_broker-client to 1.8.0
Browse files Browse the repository at this point in the history
BREAKING CHANGE

Moved `pact-publish` to `pact-broker publish`
  • Loading branch information
bethesque committed Oct 19, 2017
1 parent 6bb7452 commit f4eb23a
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packaging/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ GEM
rspec (>= 2.14)
term-ansicolor (~> 1.0)
thor
pact_broker-client (1.7.0)
pact_broker-client (1.8.0)
httparty
json
table_print (~> 1.5)
Expand Down
2 changes: 1 addition & 1 deletion packaging/README.md.template
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This version (<%= ENV.fetch('VERSION') %>) of the Pact standalone executables pa
<%= pact_provider_verifier_usage %>
```

### pact-publish
### pact-broker

```
<%= pact_publish_usage %>
Expand Down
2 changes: 1 addition & 1 deletion packaging/generate_readme_contents.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
pact_mock_service_usage = `bundle exec pact-mock-service help` + `bundle exec pact-mock-service help service`
pact_stub_service_usage = `bundle exec pact-stub-service help`
pact_provider_verifier_usage = `bundle exec pact-provider-verifier help`
pact_publish_usage = `bundle exec pact-publish help`
pact_publish_usage = `bundle exec pact-broker help publish`
puts ERB.new(ARGF.read).result(binding)
17 changes: 17 additions & 0 deletions packaging/pact-broker.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@echo off

SET RUNNING_PATH=%~dp0
CALL :RESOLVE "%RUNNING_PATH%\.." ROOT_PATH

:: Tell Bundler where the Gemfile and gems are.
set "BUNDLE_GEMFILE=%ROOT_PATH%\lib\vendor\Gemfile"
set BUNDLE_IGNORE_CONFIG=

:: Run the actual app using the bundled Ruby interpreter, with Bundler activated.
@"%ROOT_PATH%\lib\ruby\bin\ruby.bat" -rbundler/setup -I%ROOT_PATH%\lib\app\lib "%ROOT_PATH%\lib\app\pact-broker.rb" %*

GOTO :EOF

:RESOLVE
SET %2=%~f1
GOTO :EOF
2 changes: 2 additions & 0 deletions packaging/pact-broker.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require 'pact_broker/client/cli/broker'
PactBroker::Client::CLI::Broker.start
25 changes: 25 additions & 0 deletions packaging/pact-broker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh
set -e

SOURCE="$0"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
TARGET="$(readlink "$SOURCE")"
if [[ $TARGET == /* ]]; then
SOURCE="$TARGET"
else
DIR="$( dirname "$SOURCE" )"
SOURCE="$DIR/$TARGET" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
fi
done
RDIR="$( dirname "$SOURCE" )"
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

# Figure out where this script is located.
LIBDIR="`cd \"$DIR\" && cd ../lib && pwd`"

# Tell Bundler where the Gemfile and gems are.
export BUNDLE_GEMFILE="$LIBDIR/vendor/Gemfile"
unset BUNDLE_IGNORE_CONFIG

# Run the actual app using the bundled Ruby interpreter, with Bundler activated.
exec "$LIBDIR/ruby/bin/ruby" -rreadline -rbundler/setup -I$LIBDIR/app/lib "$LIBDIR/app/pact-broker.rb" $@
4 changes: 2 additions & 2 deletions packaging/pact-publish.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
require 'pact_broker/client/cli/publish'
PactBroker::Client::CLI::Publish.start
puts "ERROR: The `pact-publish` command has been moved to `pact-broker publish`. We apologise for any inconvenience caused."
exit(1)
3 changes: 3 additions & 0 deletions tasks/package.rake
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def create_package(version, target, os_type = :unix)
sh "cp packaging/pact-stub-service.rb #{package_dir}/lib/app/pact-stub-service.rb"
sh "cp packaging/pact-provider-verifier.rb #{package_dir}/lib/app/pact-provider-verifier.rb"
sh "cp packaging/pact-publish.rb #{package_dir}/lib/app/pact-publish.rb"
sh "cp packaging/pact-broker.rb #{package_dir}/lib/app/pact-broker.rb"
# sh "cp -pR lib #{package_dir}/lib/app"
sh "mkdir #{package_dir}/lib/ruby"
sh "tar -xzf build/traveling-ruby-#{version}-#{target}.tar.gz -C #{package_dir}/lib/ruby"
Expand All @@ -87,11 +88,13 @@ def create_package(version, target, os_type = :unix)
sh "cp packaging/pact-stub-service.sh #{package_dir}/bin/pact-stub-service"
sh "cp packaging/pact-provider-verifier.sh #{package_dir}/bin/pact-provider-verifier"
sh "cp packaging/pact-publish.sh #{package_dir}/bin/pact-publish"
sh "cp packaging/pact-broker.sh #{package_dir}/bin/pact-broker"
else
sh "cp packaging/pact-mock-service.bat #{package_dir}/bin/pact-mock-service.bat"
sh "cp packaging/pact-stub-service.bat #{package_dir}/bin/pact-stub-service.bat"
sh "cp packaging/pact-provider-verifier.bat #{package_dir}/bin/pact-provider-verifier.bat"
sh "cp packaging/pact-publish.bat #{package_dir}/bin/pact-publish.bat"
sh "cp packaging/pact-broker.bat #{package_dir}/bin/pact-broker.bat"
end

sh "cp -pR build/vendor #{package_dir}/lib/"
Expand Down

0 comments on commit f4eb23a

Please sign in to comment.