43 строки
1.2 KiB
Bash
Executable File
43 строки
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
echo 'Starting script/bootstrap'
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
|
|
|
|
rm -rf "${DIR}/.bundle"
|
|
rm -f "${DIR}/.puppet_version"
|
|
set -e
|
|
shopt -s extglob
|
|
cd "${DIR}/bin" && rm -f !(octocatalog-diff)
|
|
set +e
|
|
|
|
echo 'Running bundler'
|
|
cd "${DIR}" && \
|
|
rm -f Gemfile.lock && \
|
|
bundle install --without='' --no-prune --path vendor/bundle --local && \
|
|
bundle binstubs puppet rake rspec-core rubocop parallel_tests && \
|
|
chmod 0755 bin/octocatalog-diff
|
|
if [ $? -ne 0 ]; then
|
|
echo 'bundle install failed - aborting bootstrap'
|
|
exit 1
|
|
fi
|
|
|
|
# Symlink the git pre-commit script to the right place
|
|
mkdir -p "${DIR}/.git/hooks/" 2>/dev/null
|
|
ln -fs "${DIR}/script/git-pre-commit" "${DIR}/.git/hooks/pre-commit"
|
|
|
|
# Create the .puppet_version file for use during CI
|
|
# This value is consumed by script/puppet.
|
|
if [ -f "${DIR}/Gemfile.lock" ]; then
|
|
grep ' puppet ' "${DIR}/Gemfile.lock" | head -1 | awk -F '[ ()]+' '{ print $4 }' | tr -d "()" > "${DIR}/.puppet_version"
|
|
else
|
|
echo "Expected file ${DIR}/Gemfile.lock is missing!"
|
|
exit 1
|
|
fi
|
|
|
|
echo "This is what .puppet_version contains:"
|
|
cat "${DIR}/.puppet_version"
|
|
|
|
echo 'Completed script/bootstrap successfully'
|
|
exit 0
|