Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 32 lines (25 sloc) 0.791 kb
ba2b235 @mikemcquaid brew: use a shell wrapper script for brew
mikemcquaid authored
1 #!/bin/sh
681ca37 @jacknagel Suppress output from `cd`
jacknagel authored
2
3 chdir () {
4 cd "$@" >/dev/null
5 }
6
7 BREW_FILE_DIRECTORY=$(chdir "${0%/*}" && pwd -P)
12a5464 @jacknagel Use parameter expansion to avoid forking
jacknagel authored
8 export HOMEBREW_BREW_FILE="$BREW_FILE_DIRECTORY/${0##*/}"
ba2b235 @mikemcquaid brew: use a shell wrapper script for brew
mikemcquaid authored
9
77af406 @jacknagel Quote argument to readlink
jacknagel authored
10 BREW_SYMLINK=$(readlink "$0")
ba2b235 @mikemcquaid brew: use a shell wrapper script for brew
mikemcquaid authored
11 if [ -n "$BREW_SYMLINK" ]
12 then
1770a8f @adamv convert tabs to spaces in bin/brew
adamv authored
13 BREW_SYMLINK_DIRECTORY=$(dirname "$BREW_SYMLINK")
681ca37 @jacknagel Suppress output from `cd`
jacknagel authored
14 BREW_FILE_DIRECTORY=$(chdir "$BREW_FILE_DIRECTORY" &&
15 chdir "$BREW_SYMLINK_DIRECTORY" && pwd -P)
ba2b235 @mikemcquaid brew: use a shell wrapper script for brew
mikemcquaid authored
16 fi
17
681ca37 @jacknagel Suppress output from `cd`
jacknagel authored
18 BREW_LIBRARY_DIRECTORY=$(chdir "$BREW_FILE_DIRECTORY"/../Library && pwd -P)
ba2b235 @mikemcquaid brew: use a shell wrapper script for brew
mikemcquaid authored
19
3477c88 @mistydemeo Unset GEM_HOME and GEM_PATH before running brew.rb
mistydemeo authored
20 # Users may have these set, pointing the system Ruby
21 # at non-system gem paths
22 unset GEM_HOME
23 unset GEM_PATH
24
ba2b235 @mikemcquaid brew: use a shell wrapper script for brew
mikemcquaid authored
25 BREW_SYSTEM=$(uname -s | tr "[:upper:]" "[:lower:]")
26 if [ "$BREW_SYSTEM" = "darwin" ]
27 then
1770a8f @adamv convert tabs to spaces in bin/brew
adamv authored
28 exec "$BREW_LIBRARY_DIRECTORY/brew.rb" "$@"
ba2b235 @mikemcquaid brew: use a shell wrapper script for brew
mikemcquaid authored
29 else
1770a8f @adamv convert tabs to spaces in bin/brew
adamv authored
30 exec ruby -W0 "$BREW_LIBRARY_DIRECTORY/brew.rb" "$@"
ba2b235 @mikemcquaid brew: use a shell wrapper script for brew
mikemcquaid authored
31 fi
Something went wrong with that request. Please try again.