forked from pact-foundation/pact-standalone
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpact-publish.sh
More file actions
executable file
·41 lines (36 loc) · 1.18 KB
/
Copy pathpact-publish.sh
File metadata and controls
executable file
·41 lines (36 loc) · 1.18 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
36
37
38
39
40
41
#!/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
APP="$DIR/pact"
if [ -x "$APP" ]; then
if [ "$#" -eq 0 ]; then
exec "$APP" pact publish --help
else
exec "$APP" pact publish "$@"
fi
exit $?
fi
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 -rbundler/setup -rreadline -I "$LIBDIR/app/lib" "$LIBDIR/app/pact-publish.rb" "$@"