aboutsummaryrefslogtreecommitdiffstats
path: root/bin
AgeCommit message (Collapse)Author
2016-08-24bin/brew: improve /usr/local/bin/brew handling.Mike McQuaid
If `/usr/local` is the prefix but not the repository (so bottles can be used) then running `/usr/local/bin/brew` works great but `$HOMEBREW_REPOSITORY/bin/brew` assumes the prefix is `$HOMEBREW_REPOSITORY`. This is a pain when doing work on the Homebrew repository and having e.g. `bin` in your `$PATH`. Improve this behaviour so `bin/brew` knows how to handle this situation.
2016-08-24bin/brew: split up brew file symlink check.Mike McQuaid
This will enable this code to be reused in a future commit and makes it more obvious what’s being done.
2016-08-24bin/brew: refactor HOMEBREW_PREFIX="/" logic.Mike McQuaid
The previous approach of trying to do it on one line was confusing.
2016-07-15brew.{rb,sh}: move to Library/Homebrew. (#506)Mike McQuaid
2016-06-29bin/brew: fix corner cases in prefix computationMartin Afanasjew
If `bin/brew` happens to be symlinked to `/brew`, `/bin/brew`, or some similar location or (worse yet) Homebrew is installed to `/`, then computation of the prefix and/or repository path could break down and result in an invalid or empty path. Closes Homebrew/homebrew-core#2430.
2016-06-29bin/brew: rename 'chdir' to 'quiet_cd'Martin Afanasjew
This is inspired by `quiet_system` with basically the same implication (suppress output), making the name a lot less confusing and avoiding a clash with the `chdir` function defined in `Library/brew.sh`.
2016-02-25bin/brew: unset POSIX mode.Mike McQuaid
We're using /bin/bash and not /bin/sh for a reason so don't allow users to override this (seen in Homebrew/homebrew#49514). Closes Homebrew/homebrew#49515.
2016-02-18brew: Make HOMEBREW_REPOSITORY different from prefix only when 'brew' is a ↵David Caldwell
symlink Closes Homebrew/homebrew#49261. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-02-18brew: Make HOMEBREW_LIBRARY based off of HOMEBREW_REPOSITORYDavid Caldwell
This makes the logic match the Ruby code from before it was moved here (see 390e327f55126f7ee9519bc6c03a0c0aa14f7168)
2016-02-18brew: Don't re-canonicalizeDavid Caldwell
HOMEBREW_BREW_FILE and BREW_FILE_DIRECTORY are already canonicalized.
2016-02-16bin/brew: move logic to Library.Mike McQuaid
`bin/brew` is getting a bit bloated and it's annoying to open all of `HOMEBREW_PREFIX` in your editor of choice and have it search through the `Cellar`. Let's instead keep the bare minimum in `bin/brew` and move the rest to `Library`. Closes Homebrew/homebrew#49185. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-02-15brew: remove `ln` from sudo command check list.Mike McQuaid
2016-02-15Move internal command aliases from Ruby to Bash.Mike McQuaid
This means that internal command aliases can be used for Bash commands (such as the new, Bash-based `brew update`). Fixes Homebrew/homebrew#49182. Closes Homebrew/homebrew#49184. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-02-15Promote update-bash to the default updater.Mike McQuaid
Also, rename the existing updater to `update-ruby` to allow using as a fallback. It will eventually be removed. Closes Homebrew/homebrew#49109. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-02-04use BSD statTim D. Smith
Closes Homebrew/homebrew#48803.
2016-01-26bin/brew: add support for developer bash commandsMartin Afanasjew
This also means `bin/brew` is again consistent with `brew command` and `brew commands`.
2016-01-26bin/brew: put commands into 'homebrew-' namespaceMartin Afanasjew
This should help to avoid collisions with external commands and other shell functions in the future and is closer to what we do in Ruby, where commands are namespaced by being methods of the `Homebrew` module.
2016-01-26bin/brew: don't pass command name to bash commandsMartin Afanasjew
We have asserted before that the 1st argument is the command name. No need to pass it to the bash command, which will make the argument handling for the command itself a bit easier.
2016-01-26bin/bash: don't require executable command filesMartin Afanasjew
Commands implemented in shell (bash) are supposed to be sourced from `bin/bash` instead of being executed directly. Consequently, don't expect the implementation files to be executable.
2016-01-20bin/brew: use not operator inside `[[`Xu Cheng
2016-01-20bin/brew: use full path for xcode-selectXu Cheng
Closes Homebrew/homebrew#48197. Signed-off-by: Xu Cheng <xucheng@me.com>
2016-01-20bin/brew: remove unpin from sudo check listXu Cheng
We only need to check sudo for commands which create files.
2016-01-20bin/brew: include alias in sudo checkXu Cheng
2016-01-20bin/brew: introduce odie functionXu Cheng
2016-01-20bin/brew: always use `[[` for consistencyXu Cheng
2016-01-20bin/brew: remove unnecessary checkXu Cheng
HOMEBREW_BASH_COMMAND variable will always exist. So we only need to check whether the corresponding file exist or not.
2016-01-20bin/brew: fix incorrect argument manipulationXu Cheng
Shifting `-v` argument is all we need to do. We shouldn't enumerate arguments.
2016-01-18bin/brew: use a function to avoid issues.Mike McQuaid
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-17Move some brew.rb logic to bin/brew.Mike McQuaid
2016-01-17bin/brew: allow writing Homebrew commands in Bash.Mike McQuaid
2016-01-17bin/brew: set more HOMEBREW_* env from Bash.Mike McQuaid
2015-12-23bin/brew: enforce UTF-8 localeMartin Afanasjew
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-01bin/brew: avoid unnecessary 'readlink' invocationMartin Afanasjew
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-01bin/brew: avoid unnecessary 'tr' invocationMartin Afanasjew
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-01bin/brew: separate variable assignment and exportMartin Afanasjew
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-01bin/brew: quote in assignments for consistencyMartin Afanasjew
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-01bin/brew: be consistent about code styleMartin Afanasjew
2015-11-20brew: ensure full path for HOMEBREW_RUBY_PATHXu Cheng
2015-11-20brew.rb: export HOMEBREW_RUBY_PATH.Mike McQuaid
2015-11-18travis: test 10.9 using Ruby 1.8.Mike McQuaid
Closes Homebrew/homebrew#45816. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2014-11-25Suppress output from `cd`Jack Nagel
Closes Homebrew/homebrew#34246.
2014-05-17convert tabs to spaces in bin/brewAdam Vandenberg
2014-05-02Quote argument to readlinkJack Nagel
2014-05-02Use parameter expansion to avoid forkingJack Nagel
2014-02-21Unset GEM_HOME and GEM_PATH before running brew.rbMisty De Meo
This was reported in Tigerbrew, but is a worthwhile fix everywhere. Fixes mistydemeo/tigerbrew#177.
2013-02-21brew: use a shell wrapper script for brewMike McQuaid
This reverts commit dfd4dd12a41e1697ee9d5feac12cc1ea7c3a590e. Fixes the problems from Homebrew/homebrew#17683 and Homebrew/homebrew#17685.
2013-02-21brew: move to Library/brew.rbMike McQuaid
This reverts commit ac156b36d00ead5f225389f0a1d8069d0c1cce4a.
2013-02-18Rename Library/Contributions/cmds -> cmd.Mike McQuaid
2013-02-18Rework brew command dispatch order.Mike McQuaid
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-08Revert "brew: move to Library/brew.rb"Mike McQuaid
This reverts commit 67d06b84d00a17cf43770eedf34e37e50e209741. Closes Homebrew/homebrew#17683. Closes Homebrew/homebrew#17685.