I added a new `FormulaUnreadableError` subclass of
`FormulaUnavailableError` so existing `rescue`s of
`FormulaUnavailableError` handle this as well.
The new subclass will output the name of the formula with the error
(because this isn't always obvious from the original exception message)
followed by the original error message.
Fixes#1927.
We want to prefer the newer/versioned formulae when possible but this
is preferable to a random cached formula or, worse, no formula.
This means `brew info foo` will never complain that `foo` is a missing
formula.
When reading a building a formula from a keg (rather than e.g. from
name) then the deprecation options were not remapped correctly as they
are only done in `Tab.for_formula` and not `Tab.for_keg`. Ensure that
after we’ve created the formula that the `used_options` are remapped
correctly.
If there’s an old installation of e.g. `apple-gcc42` from when it was
part of `homebrew/core` then the tab will say it was from the
`homebrew/core` tap and then we’ll complain at the user (see #1459 for
an example). Instead, we only want to complain when the user actually
types in `homebrew/core/apple-gcc42` into a `brew` command.
Closes#1459.
e.g. allow `brew install some/tap/formula` to look that formula up in
another tap if it has been migrated.
Also, add a deprecation message to point people towards the correct
naming.
If we try to call `Formulary.from_keg(f, :head)` on the keg that
is not HEAD-keg itself, we don't need to update commit of
returned formula and should use just HEAD version with nil commit.
Same is true for `ARGV.resolved_formulae`
Prior to this change there were only 3 instances of `STD(IN|OUT|ERR)`
versus 74 instances of `$std(in|out|err)` in the Homebrew code base. The
latter variant is also strongly suggested by bbatsov's Ruby Style Guide.
* Use `Tap#formula_dir` instead of `Tap#formula_files` to find formula
file to have better performance and avoid caching issue.
* Change the loader logic to search name -> search alias -> search old name.
This is more consistence with what we do when loading core formula
file.
ClosesHomebrew/homebrew#49484.
Signed-off-by: Xu Cheng <xucheng@me.com>
For users whose local brew is at around 2015-06-11 to 2015-08-06,
running `brew update` will emit following error:
Error: uninitialized constant Formulary::CoreFormulaRepository
This is caused by the same bug described in Homebrew/homebrew#42553.
This commit workarounds this issue and restores `brew update` compatibility
for users mentioned above.
Also cleanup legacy `require "cmd/tap"`.