-
Notifications
You must be signed in to change notification settings - Fork 87
/
Copy pathbootstrap
executable file
·42 lines (34 loc) · 1.18 KB
/
bootstrap
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
42
#!/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