my-boxen/script/bootstrap
John Bellone 79a74a6555 Update script/bootstrap sudo to pass environment variables.
When executing a boxen run from inside the corporate firewall we need to pass
proxies through to sudo so that bundler will be installed properly as root.
2013-12-26 12:49:03 -05:00

30 lines
No EOL
872 B
Bash
Executable file

#!/bin/sh
# Make sure all our local dependencies are available.
set -e
# FIX: only sudo if gem home isn't writable
(/usr/bin/gem list -i bundler -v '~> 1.3.0' > /dev/null) || {
/usr/bin/sudo -E -p "Need to install Bundler for system ruby, password for sudo: " \
/usr/bin/gem install bundler -v '~> 1.3.0' --no-rdoc --no-ri
}
# We don't want old config hanging around.
rm -rf .bundle/config
rm -rf .librarian/puppet/config
# Put xcrun shim on PATH if on MoLo
set +e
OSX_VERSION_CHECK=`sw_vers | grep ProductVersion | cut -f 2 -d ':' | egrep '10\.8'`
if [ $? -eq 0 ]; then
export PATH=$(pwd)/vendor/shims:$PATH
fi
set -e
# Bundle install unless we're already up to date.
/usr/bin/bundle install --binstubs bin --path .bundle --quiet "$@"
# Fix the binstubs to use system ruby
find bin -type f -print0 | xargs -0 sed -i '' 's|/usr/bin/env ruby|/usr/bin/ruby|g'