forked from Homebrew/legacy-homebrew
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrew
executable file
·31 lines (25 loc) · 791 Bytes
/
brew
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
#!/bin/sh
chdir () {
cd "$@" >/dev/null
}
BREW_FILE_DIRECTORY=$(chdir "${0%/*}" && pwd -P)
export HOMEBREW_BREW_FILE="$BREW_FILE_DIRECTORY/${0##*/}"
BREW_SYMLINK=$(readlink "$0")
if [ -n "$BREW_SYMLINK" ]
then
BREW_SYMLINK_DIRECTORY=$(dirname "$BREW_SYMLINK")
BREW_FILE_DIRECTORY=$(chdir "$BREW_FILE_DIRECTORY" &&
chdir "$BREW_SYMLINK_DIRECTORY" && pwd -P)
fi
BREW_LIBRARY_DIRECTORY=$(chdir "$BREW_FILE_DIRECTORY"/../Library && pwd -P)
# Users may have these set, pointing the system Ruby
# at non-system gem paths
unset GEM_HOME
unset GEM_PATH
BREW_SYSTEM=$(uname -s | tr "[:upper:]" "[:lower:]")
if [ "$BREW_SYSTEM" = "darwin" ]
then
exec "$BREW_LIBRARY_DIRECTORY/brew.rb" "$@"
else
exec ruby -W0 "$BREW_LIBRARY_DIRECTORY/brew.rb" "$@"
fi