forked from pact-foundation/pact-standalone
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpact-message.sh
More file actions
executable file
·35 lines (30 loc) · 1.17 KB
/
Copy pathpact-message.sh
File metadata and controls
executable file
·35 lines (30 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
set -e
SOURCE="$0"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
TARGET="$(readlink "$SOURCE")"
START="$( echo "$TARGET" | cut -c 1 )"
if [ "$START" = "/" ]; 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 )"
if [ -z "${PACT_CLI_LEGACY}" ]; then
echo "pact-message is deprecated. Please use pact_mock_server_cli instead."
echo "or set the PACT_CLI_LEGACY environment variable to use the old CLI."
exit 1
fi
# 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
unset RUBYGEMS_GEMDEPS
unset BUNDLE_APP_CONFIG
export BUNDLE_FROZEN=1
# Run the actual app using the bundled Ruby interpreter, with Bundler activated.
exec "$LIBDIR/ruby/bin/ruby" -E UTF-8 -rreadline -rbundler/setup -I "$LIBDIR/app/lib" "$LIBDIR/app/pact-message.rb" "$@"