Blame view

script/bootstrap 1.05 KB
3a47d364c   Jianwei Han   Remove caches for...
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
  #!/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'