aboutsummaryrefslogtreecommitdiffstats
path: root/Library/brew.rb
AgeCommit message (Collapse)Author
2016-05-03analytics: move to a class. Mike McQuaid
Global namespaces are good to avoid when possible.
2016-04-21brew.rb: uninstall old Homebrew Cask. (#121)Mike McQuaid
This version is never wanted at this point and it will help Homebrew Cask deal with the annoying errors that result from having this version still around (some which I've already help users debug).
2016-04-20exceptions: add reason to 'UsageError' exceptionMartin Afanasjew
Use the `reason` attribute to be able to handle `UsageError` subclasses more uniformly and simplify logic in `brew.rb` to handle them together.
2016-04-20help: show command-specific help for invalid usageMartin Afanasjew
Instead of always printing the generic help text, print command-specific help if it is available and a command raised the `UsageError` exception. Put the error message underneath the help text (was above) to avoid that it scrolls off the screen. Thereby fix a regression where handling the invalid usage would fail to access `ARGV.usage` removed in c6536066dc39da653d265640c6ba6046bb5def98.
2016-04-20help: refactor (again) and fix code style issuesMartin Afanasjew
Turns out making `empty_argv` a boolean argument for `Homebrew.help` was not the best idea and having command-to-path mapping and help extraction in a single method is not flexible enough. Also only complain about missing help text when `HOMEBREW_DEVELOPER=1` and otherwise just print the generic help text.
2016-04-20brew.rb: fix Ruby syntax warningMartin Afanasjew
Library/brew.rb:108: warning: `*' interpreted as argument prefix
2016-04-18brew.rb: don't show help for 'brew <command> help'Martin Afanasjew
Showing help makes sense for `brew help <command>`, but showing it for `brew <command> help` is undesirable and prevents all commands from accepting a named argument `help` (formula, tap, file name, etc.). All other help flags are still detected before *and* after the command. Closes #103. Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-04-18help: handle help output (move from 'brew.rb')Martin Afanasjew
Keep the footprint of `brew.rb` small. Handle fetching/displaying an appropriate help text (taking into account various external conditions) in the `help` command.
2016-04-10brew.rb: adjust behavior for undocumented commandsMartin Afanasjew
Don't exit with a non-zero status code just because an internal command happens to be undocumented. Also print the generic help in these cases to provide some help (including a reference to the man page).
2016-04-10Implement the `brew help` commandMax Nordlund
This is also used by `brew <cmd> --help`. The basic idea is to have the documentation as a top level comment in each command file. To find these comments, they have to be like this `#:`. This is also used by the `brew man` command to keep the documentation DRY, and for that there are now a header and footer for the man page.
2016-04-04brew.rb: report some exceptions.Mike McQuaid
2016-04-02--version/config: show core tap informationXu Cheng
2016-03-21add HOMEBREW_ENV_PATH internal variableXu Cheng
`Library/ENV` like `Library/Homebrew` is part of Homebrew basecode. It should be able to be accessed during the `brew tests`. By adding HOMEBREW_ENV_PATH variable, we allow test suit to locate these codes.
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-05brew.rb: remove executable bit and shebangMartin Afanasjew
Because `brew.rb` should never be invoked directly, remove executable bit and shebang to make that more obvious. Closes Homebrew/homebrew#48816. Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-02-06make HOMEBREW_BREW_FILE a Pathname objectXu Cheng
Currently HOMEBREW_BREW_FILE is a String, while other of HOMEBREW_* variables are all Pathname. This commit unifies them all as Pathname, so it will not cause any confusion. Closes Homebrew/homebrew#48872. Signed-off-by: Xu Cheng <xucheng@me.com>
2016-02-01brew.rb: use $stderr for debug and errors.ilovezfs
Closes Homebrew/homebrew#48634. Closes Homebrew/homebrew#48681. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-01-27config: fail when HOMEBREW_BREW_FILE is unset.Mike McQuaid
Not sure why this is happening (beyond the Chef cookbook stupidly deciding to not call through `bin/brew`) but fail and print a scary looking error to hope to point people in the right direction. Closes Homebrew/homebrew#48261. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-01-26brew.rb: don't re-export for external commandsMartin Afanasjew
`bin/brew` already sets up a bunch of environment variables. There's no need to re-export them for external commands. (`HOMEBREW_LIBRARY_PATH` and `HOMEBREW_CACHE` continue to be determined later in the Ruby code.)
2016-01-20brew.rb: fix style problemXu Cheng
Generated by `brew style --fix Library/brew.rb`
2016-01-20brew.rb: fix overeager help flag matchingXu Cheng
2016-01-20brew: remove duplicated logicXu Cheng
This is now handled by `bin/brew`
2016-01-17Move some brew.rb logic to bin/brew.Mike McQuaid
2016-01-14brew: tap missing tap as normal userXu Cheng
Before this, `sudo brew cask` will auto install Homebrew cask as root user. This will cause permission problem for files in `Tap` directory. Therefore, let's check process uid and switch to normal user for tap. As result, `sudo brew cask` will work as the same before, except tap files will have the correct permission attributes. Closes Homebrew/homebrew#48059. Signed-off-by: Xu Cheng <xucheng@me.com>
2015-12-21brew.rb: only print "Kernel.exit" on failures.Mike McQuaid
Also, print as a warning to STDERR and print a backtrace in debug mode. Closes Homebrew/homebrew#47099. Closes Homebrew/homebrew#47154. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-12-10brew.rb: improve handling of --version/-v optionMartin Afanasjew
Make both `--version` and `-v` print the Homebrew version and exit, if provided as first and sole argument. `brew --version` no longer accepts additional arguments (they were previously ignored). Otherwise interpret `brew -v <arguments>` as if `brew <arguments> -v` was executed instead (no change here), but no longer print a line with the Homebrew version. Closes Homebrew/homebrew#46790. Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2015-12-10brew: cask is now a tap command.Mike McQuaid
So we can remove the formula installation from `brew.rb`. Closes Homebrew/homebrew#46843. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-12-08brew.rb: handle cask autoinstall when cask tapped.Mike McQuaid
Otherwise it would assume if `cask` was tapped it was also installed.
2015-11-09auto install certain external commandsXu Cheng
Closes Homebrew/homebrew#45773. Signed-off-by: Xu Cheng <xucheng@me.com>
2015-10-19brew: add more non-root-user sudo checksDominyk Tiller
2015-10-19brew: tighten sudo checksDominyk Tiller
`reinstall` can currently be executed under sudo and has every chunk of problems running install under sudo does when `brew` isn't root owned. Likewise with `postinstall` which we increasingly use to create directories and move/install files elsewhere. Using sudo there both masks deeper issues and makes uninstall troublesome. Closes Homebrew/homebrew#45112. Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
2015-10-15brew: check xcode license statusDominyk Tiller
The xcrun code is stolen right out of the INSTALL script. Check for user agreement of the Xcode license before permitting any other brew usage to continue. This prevents the situation where people are instructed to "please re-run as root via sudo" on brew commands. The check can only fail when Xcode is installed & the active developer dir. Closes Homebrew/homebrew#44974. Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
2015-09-12add dev-cmd folderXu Cheng
2015-08-25include git sha1 in --version outputTim D. Smith
HOMEBREW_VERSION doesn't change very often; the repository state is more interesting. Closes Homebrew/homebrew#41886.
2015-08-03More core files style updatesXu Cheng
2015-08-03Core files style updates.BrewTestBot
Closes Homebrew/homebrew#42354. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-07-28brew: print bug report URL for internal commands onlyBaptiste Fontaine
Closes Homebrew/homebrew#42069. Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2015-07-03add `brew command`Xu Cheng
Closes Homebrew/homebrew#41034. Signed-off-by: Xu Cheng <xucheng@me.com>
2015-06-20sudo_check: don't use a setBaptiste Fontaine
This is unnecessary here because we use it only once. The difference won't be noticeable but the check is ~5 times faster now. Closes Homebrew/homebrew#40901. Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2015-06-16Move 10.11 warning to doctor, pre-install, and post-failureJack Nagel
Fixes Homebrew/homebrew#40778.
2015-06-14brew: warn about 10.11 unsupportedDominyk Tiller
Issue a warning about Homebrew's very basic support for 10.11 at this point in time on each run of `brew`. Closes Homebrew/homebrew#40536. Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
2015-05-14Stop supporting LeopardMisty De Meo
Is this really Misty?!
2015-04-21Inline error messageJack Nagel
2015-04-20Simplify setting load pathJack Nagel
2015-02-06brew.rb: fix help regex.Roberto Nibali
Don't match `help` at the end of every string because `brew installhelp` shouldn't really be running help. Closes Homebrew/homebrew#36559. Closes Homebrew/homebrew#36576. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-01-15brew.rb: remove unneeded exit code duplication.Mike McQuaid
Fixes comments made in: https://github.com/Homebrew/homebrew/commit/91c267bdb1607334febaac3272ccc62ada6ae4fd#commitcomment-9146910.
2015-01-04brew.rb: return exit code from internal commands.Mike McQuaid
2015-01-03Remove unnecessary encoding commentsJack Nagel
These files do not contain any non-ASCII characters.
2014-10-02Move SCM wrappers from Contributions to ENV/scm.Mike McQuaid
Closes Homebrew/homebrew#32615. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2014-09-24brew: add contributed tap commands to PATH.Mike McQuaid
This means that taps root and `cmd` directories are added to the PATH. This should enable migration of some of our contributed commands into taps (e.g. `homebrew-boneyard`) and make it easy for third parties to be able to maintain these. It might also make stuff easier for existing tools like e.g. `brew-cask` and `boxen`. Closes Homebrew/homebrew#32471.