475 Commits

Author SHA1 Message Date
Xu Cheng
b324d61f35 bin/brew: remove unpin from sudo check list
We only need to check sudo for commands which create files.
2016-01-20 13:55:06 +08:00
Xu Cheng
e3011dfe91 bin/brew: include alias in sudo check 2016-01-20 13:55:06 +08:00
Xu Cheng
e12e1a5d5d bin/brew: introduce odie function 2016-01-20 13:55:06 +08:00
Xu Cheng
3fdf1a623b bin/brew: always use [[ for consistency 2016-01-20 13:55:06 +08:00
Xu Cheng
29c50d2567 bin/brew: remove unnecessary check
HOMEBREW_BASH_COMMAND variable will always exist. So we only need to
check whether the corresponding file exist or not.
2016-01-20 13:55:06 +08:00
Xu Cheng
6b5b8757bf bin/brew: fix incorrect argument manipulation
Shifting `-v` argument is all we need to do. We shouldn't enumerate
arguments.
2016-01-20 13:55:06 +08:00
Mike McQuaid
b118539c8c bin/brew: use a function to avoid issues.
Otherwise when `bin/brew` is updated in-place Bash will carry on from
the offset and this can cause issues.

Thanks to `@UniqMartin` for pointing this out.
2016-01-18 09:37:46 +00:00
Mike McQuaid
6f91b429ce Move some brew.rb logic to bin/brew. 2016-01-17 19:48:02 +00:00
Mike McQuaid
b01ce41164 bin/brew: allow writing Homebrew commands in Bash. 2016-01-17 19:48:02 +00:00
Mike McQuaid
effca7d9c6 bin/brew: set more HOMEBREW_* env from Bash. 2016-01-17 19:39:41 +00:00
Martin Afanasjew
8d3f33de90 bin/brew: enforce UTF-8 locale
Everyone should be using a UTF-8 locale nowadays. Not using one causes
issues like `brew doctor` failing while checking symbolic links that
point at file names with non-ASCII characters, since OS X always uses
Unicode for the file system.

Rely on `locale charmap` to detect the currently selected encoding and
if that's not UTF-8, override the user's choice (if any) by setting
`LC_ALL` to `en_US.UTF-8`, the assumption being that every system has a
usable `en_US.UTF-8` locale installed.

Fixes Homebrew/homebrew#44744.
Closes Homebrew/homebrew#47247.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2015-12-23 06:54:11 +01:00
Martin Afanasjew
f1a7e51d2a bin/brew: avoid unnecessary 'readlink' invocation
For typical installations where `brew` is not a symbolic link, this
reduces the number of processes that need to be spawned.

Closes Homebrew/homebrew#46269.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2015-12-01 21:36:05 +01:00
Martin Afanasjew
5b828d4265 bin/brew: avoid unnecessary 'tr' invocation
This reduces the number of processes that need to be forked. If
libtool's `config.guess` is to be trusted, there was never another
spelling/capitalization other that `Darwin`.
2015-12-01 21:36:05 +01:00
Martin Afanasjew
8f175cb03c bin/brew: separate variable assignment and export
This very slightly reduces duplication and the risk of inconsistency by
exporting in one branch, but not the other. By putting all the `export`
statements right before the `exec` it is more obvious what is passed on.
2015-12-01 21:36:05 +01:00
Martin Afanasjew
73a7889de5 bin/brew: quote in assignments for consistency
While `var=$(<command>)` is perfectly valid and won't create any issues,
it is often surprising for less shell-savvy users. Quoting these cases
like in all other instances makes the code more uniform, helps to avoid
future mistakes, and has no downsides.
2015-12-01 21:36:05 +01:00
Martin Afanasjew
fb4a2ea387 bin/brew: be consistent about code style 2015-12-01 21:36:05 +01:00
Xu Cheng
aeb8aad1e0 brew: ensure full path for HOMEBREW_RUBY_PATH 2015-11-20 19:52:19 +08:00
Mike McQuaid
f5104a7946 brew.rb: export HOMEBREW_RUBY_PATH. 2015-11-20 10:24:27 +00:00
Mike McQuaid
c6621faf18 travis: test 10.9 using Ruby 1.8.
Closes Homebrew/homebrew#45816.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-11-18 17:06:28 +00:00
Jack Nagel
18d1d1511b Suppress output from cd
Closes Homebrew/homebrew#34246.
2014-11-25 22:27:03 -05:00
Adam Vandenberg
6908781264 convert tabs to spaces in bin/brew 2014-05-17 10:08:02 -07:00
Jack Nagel
253140c92d Quote argument to readlink 2014-05-02 21:55:44 -05:00
Jack Nagel
bb750e1439 Use parameter expansion to avoid forking 2014-05-02 21:55:44 -05:00
Misty De Meo
5a7a5c3eae Unset GEM_HOME and GEM_PATH before running brew.rb
This was reported in Tigerbrew, but is a worthwhile fix everywhere.

Fixes mistydemeo/tigerbrew#177.
2014-02-21 20:54:23 -08:00
Mike McQuaid
f9f05d1173 brew: use a shell wrapper script for brew
This reverts commit dfd4dd12a41e1697ee9d5feac12cc1ea7c3a590e.

Fixes the problems from Homebrew/homebrew#17683 and Homebrew/homebrew#17685.
2013-02-21 21:42:18 +00:00
Mike McQuaid
191e9ed88a brew: move to Library/brew.rb
This reverts commit ac156b36d00ead5f225389f0a1d8069d0c1cce4a.
2013-02-21 21:42:18 +00:00
Mike McQuaid
4a281cd5cf Rename Library/Contributions/cmds -> cmd. 2013-02-18 10:42:44 +00:00
Mike McQuaid
e9d58c4100 Rework brew command dispatch order.
Make it no longer possible to override e.g. `brew install` with a
script if there is already a built-in Homebrew command named
`brew install`.

References Homebrew/homebrew#17673
2013-02-18 10:42:43 +00:00
Mike McQuaid
1e47298456 Revert "brew: move to Library/brew.rb"
This reverts commit 67d06b84d00a17cf43770eedf34e37e50e209741.

Closes Homebrew/homebrew#17683.
Closes Homebrew/homebrew#17685.
2013-02-08 08:55:53 -08:00
Mike McQuaid
551005acdb Revert "brew: use a shell wrapper script for brew"
This reverts commit 225546a3ee2d3f22e185e47d4db6f6716a56669b.
2013-02-08 08:55:42 -08:00
Mike McQuaid
faa066b109 brew: use a shell wrapper script for brew
This allows us to force using the system Ruby on OSX but allow
the development of Homebrew for Linux or Windows to not rely
on OSX paths.

Closes Homebrew/homebrew#17548.
2013-02-07 17:53:49 -08:00
Mike McQuaid
7344149f52 brew: move to Library/brew.rb 2013-02-07 17:48:29 -08:00
Misty De Meo
1bce10ad6c Replace sceaga/homebrew with mistydemeo/tigerbrew
@sceaga has discontinued his homebrew fork, so tigerbrew is now PPC/
Tiger users' best bet.
2012-12-27 21:55:15 -04:00
Max Howell
3935a34048 brew -c1 one line configuration summary
At your option: `brew --config -1`.
2012-08-31 15:48:48 -04:00
Max Howell
2cecc3bd51 If exception has no message raise again
Shows full backtrace, which is useful. Now blank "raise" statements are the equivalent of admitting programmer error. The backtrace will be useful.
2012-08-29 12:41:37 -04:00
Max Howell
0ac3e83a7a Make brew --prefix very fast
Because people use this in .bash_profile etc. We should be as fast as possible.
2012-08-29 12:41:36 -04:00
Max Howell
20ce16a3ff Much better CTRL-C handling
Let's not show weird error messages when user interrupts during various stages of brew initialization.

Tested by doing `for x in $(brew search); do brew install $x; done` and pressing CTRL-C at random short intervals.
2012-08-29 12:41:35 -04:00
Misty De Meo
78dcafaa10 brew: downcase arg before sending to Homebrew
Fixes a case where brew would find commands with wrongly-capitalized
user input on case-insensitive systems, then error out with a confusing
message when an invalid method was sent to Homebrew. e.g.:

> brew Update
Error: undefined method `Update' for Homebrew:Module
2012-08-22 19:55:27 -05:00
Max Howell
97b841c1d5 Don't output Ruby warnings
We don't want bug reports about this crap, even though the user REALLY should listen to the warning message. What actually happens is they blame us instead.

This kind of warning in particular:

warning: Insecure world writable dir /usr/local/bin in PATH
2012-08-06 13:06:36 -04:00
Adam Vandenberg
7a7e3b5f7c Make --version/--verbose slightly less confusing. 2012-07-23 14:27:50 -07:00
Misty De Meo
7af4622b0f Replace /usr/bin/ruby with full Framework path
Rationale: some users insist on replacing the /usr/bin/ruby symlink
to point to another ruby on their system, which may break homebrew.
Use the full Framework path instead, which is less likely to be tampered with.

This also reorganizes the brew --config checks to reflect the different path.

Fixes Homebrew/homebrew#12009.

Closes Homebrew/homebrew#12333.

Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
2012-06-01 09:24:25 -05:00
Jack Nagel
68124d481f Unify 'which' and which_s' utility methods
'which' only returns a Pathname or nil, and doesn't care about anything
sent to stderr, so just silence it by default and combine the two
methods.

Closes Homebrew/homebrew#12115.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-05-07 21:05:47 -05:00
Mike McQuaid
0cbdeeaa3c Exit with bad exit code on command failures. 2012-03-29 18:44:37 +11:00
Mike McQuaid
23b84ef732 Set MACOS_VERSION as 0 on non-OSX platforms. 2012-03-18 15:43:39 +13:00
Mike McQuaid
e33937a1e3 Rename external commands directory from examples.
Fixes Homebrew/homebrew#10829.
2012-03-18 15:34:41 +13:00
Adam Vandenberg
a396e5e720 Remove 'is this a git command?' 2012-03-07 07:00:27 -08:00
Max Howell
15a70c36d0 Move brew output for BuildError into BuildError
So upgrade can output errors but continue to upgrade the rest of the installation.
2012-03-07 12:33:47 +00:00
Max Howell
7cedf67680 Scupper sourceable output if brew install is piped
`brew install > file` should not give "export CC=/foo" output on Build Failures.

Also moved the "Using clang" output to brew when BuildError is thrown as that is where it is interesting, and not if you just do `brew --env`.
2012-03-02 00:59:39 +00:00
Charlie Sharpsteen
028104b861 metadata: Record installation options
Adds a new class called `Tab` that acts as a recipt for install options. A
`Tab` can be serialized to a JSON file for future reference.
2011-11-13 12:14:56 -08:00
Dougal Sutherland
8e2002fc27 brew command: exit with nonzero status for unknown command name
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2011-10-27 17:55:34 -07:00