bootstrap 1.05 KB
#!/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.5.3' > /dev/null) || {
  /usr/bin/sudo -E -p "Need to install Bundler for system ruby, password for sudo: " \
  /usr/bin/gem install bundler -v '~> 1.5.3' --no-rdoc --no-ri
}

# We don't want old config hanging around.

rm -rf .bundle/config
rm -rf .librarian/puppet/config

CLT_VERSION=`pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version | cut -f 2 -d ' ' | awk ' { print $1; } '`

# Bundle install unless we're already up to date.
if [[ $CLT_VERSION =~ ^5\.1\.0\.0\.1\.1396320587 ]]; then
  # Fix for LLVM that ships with Xcode 5.1
  ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future /usr/bin/bundle install --binstubs bin --path .bundle --quiet "$@"
else
  /usr/bin/bundle install --binstubs bin --path .bundle --quiet "$@"
fi


# Fix the binstubs to use system ruby
find bin -not -path 'bin/\.*' -type f -print0 | xargs -0 /usr/bin/sed -i '' 's|/usr/bin/env ruby|/usr/bin/ruby|g'