170 Commits

Author SHA1 Message Date
Alyssa Ross
a9dc02a586
Don't suggest install from bottle if not available
It only makes sense to tell a user to try installing from a bottle if
there are bottles available for them to install for all the formulae
they specified.
2018-01-28 22:47:39 +00:00
Markus Reiter
9bee9ca575 Use “squiggly” heredocs. 2017-10-18 14:39:09 +02:00
Shaun Jackman
3ed832d4f0 BottleLoader: Use the formula stored in the bottle 2017-09-28 12:29:23 -07:00
Mike McQuaid
cf5fdeef1d Rubocop: manual rule fixes. 2017-09-24 21:23:59 +01:00
Markus Reiter
6d6ce7cf0a Detect Tap in CaskLoader. 2017-07-30 14:22:05 +02:00
Mike McQuaid
7a0aff1080 Autocorrect Rubocop Style/PerlBackrefs. 2017-06-10 20:23:20 +03:00
Mike McQuaid
99c897acad BuildError: report options to analytics.
Without this it's not easy to make much sense of these failures.
2017-06-09 14:53:01 +03:00
Markus Reiter
2d6ae61314 Re-revert "Fix operator spacing." 2017-06-02 19:22:05 +02:00
ilovezfs
197392b56d Revert "Fix operator spacing." 2017-06-01 04:06:40 -07:00
Markus Reiter
d34ba7395b Fix operator spacing. 2017-05-31 19:53:41 +02:00
Mike McQuaid
ef59a751f4 Improve some brew install messaging.
Improve the messaging around `brew install` when there's a possible user
action such as an `upgrade` or `link` and don't tell people to
`install --force` when it's unnecessary.

While I did this, tweak the output and function usage in a couple of
related places.

Some example output before this change:
```
Warning: openssl is a keg-only and another version is linked to opt.
Use `brew install --force` if you want to install this version
Warning: mysql@5.6 is a keg-only and another version is linked to opt.
Use `brew install --force` if you want to install this version
Warning: analog-6.0_1 already installed
Warning: bash-completion@2-2.5 already installed, it's just not linked.
```

Some example output after this change:
```
Error: openssl 1.0.2k is already installed
To upgrade to 1.0.2l, run `brew upgrade openssl`
Warning: mysql@5.6 5.6.36_1 is already installed
Warning: analog 6.0_1 is already installed
Warning: bash-completion@2 2.5 is already installed, it's just not linked.
You can use `brew link bash-completion@2` to link this version.
```
2017-05-27 10:15:37 +01:00
Mike McQuaid
1330b74416 install: don't search when formula is unreadable.
These formulae are detected as missing but exist in an unreadable form.

Fixes #2485
2017-04-18 08:43:39 +01:00
Mike McQuaid
2047dbd50e Update all references to taps.
- Remove taps that are (or will shortly be) deprecated.
- Remove commands that are only relevant to the boneyard (which will
  shortly be removed).
2017-03-26 19:42:35 +01:00
Alyssa Ross
ade8128a18 formulary: handle ScriptError in formula
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.
2017-02-01 18:34:20 +00:00
Mike McQuaid
598c5e36f9 Tell people to report URL/tap deprecations to the tap.
Rather than Homebrew/brew or Homebrew/homebrew-core.
2016-12-10 13:04:14 +00:00
Mike McQuaid
3c77faeb14 exceptions: better handle unsupported macOS versions.
Don’t fail on `OS::ISSUES_URL` being missing (which happens on
unsupported macOS versions) and instead tell people to not file issues.
2016-11-24 08:54:38 +00:00
Mike McQuaid
a1e798d964 exceptions: reorder output based on importance. 2016-11-05 15:39:25 -04:00
Mike McQuaid
83af084079 exceptions: use specific build error checks. 2016-11-05 10:58:39 -04:00
Markus Reiter
b306f14b97 Rename FormulaMethodDeprecatedError to MethodDeprecatedError. 2016-10-08 13:26:10 +02:00
ilovezfs
23a38e0ff6 virtualenv_install_with_resources: select correct python
`virtualenv_install_with_resources` will now attempt to guess the
desired Python based on the active build options and based on the
dependencies and requirements. When the situation is ambiguous (e.g.,
`depends_on :python3` and `build.with? "python"` is true) raise
`FormulaAmbiguousPythonError` unless `:using => "python"` or
`:using => "python3"` has been passed to resolve the ambiguity.

In most cases, this will allow

```
    virtualenv_create(libexec, "python3")
    virtualenv_install_with_resources
```

to be changed to just

```
    virtualenv_install_with_resources
```
2016-10-02 18:08:56 -07:00
Markus Reiter
884b268506 Use Formatter for all URLs. 2016-10-01 20:00:49 +02:00
Markus Reiter
75e8b59aad Add Formatter module. 2016-10-01 20:00:49 +02:00
Markus Reiter
6d8ee395fa Refactor Tty. 2016-10-01 20:00:49 +02:00
Mike McQuaid
3f9cce0a03 Use new "macOS" naming where appropriate.
Not quite a mass replacement as I've used OS X and Mac OS X where
describing specific older versions and added compatibility methods
for things in the DSL.
2016-09-18 19:57:19 +01:00
Mike McQuaid
3982950e61 rubocop --auto-correct all hash-rocket usage. 2016-09-17 16:14:13 +01:00
Mike McQuaid
6693915399 rubocop --auto-correct all remaining files.
But remove some manual `.freeze`s on constants that shouldn't be
constants.
2016-09-17 16:14:13 +01:00
Mike McQuaid
7dddc4df9f exceptions: assume Ruby 2. 2016-08-17 09:19:56 +01:00
Xu Cheng
a8566c9848 various: eliminate the usage of any? (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)).
2016-08-05 22:01:32 +08:00
Mike McQuaid
af2101b64d exceptions: add FormulaMethodDeprecatedError.
This will be raised when Homebrew developers try to use formulae that
call deprecated methods.
2016-07-29 21:21:29 -06:00
Mike McQuaid
270b0ec783 exceptions: port to generic layer. 2016-07-27 15:05:42 -06:00
Tony Kelman
fe89467832 exceptions: Remove duplicate "a" in "must be built from source" error (#339)
otherwise would get "cannot be installed as a a binary package"
since `package_text` contains "a binary package" in the singular case
2016-06-08 17:53:11 +02:00
Martin Afanasjew
4ea2f9dc91 Fix more bad dump_verbose_config references
Follow-up to c7edf9a063dce63afb9ab54b6d71fe864d578365 and related to
changes from #168.
2016-05-08 21:43:57 +02:00
Misty De Meo
9ead6bc2f8 Update CompilerSelectionError
Fixes mistydemeo/tigerbrew#207.
Fixes mistydemeo/tigerbrew#330.
2016-04-22 22:37:21 -07:00
Martin Afanasjew
d9363a1559 exceptions: add reason to 'UsageError' exception
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-20 13:46:10 +02:00
Martin Afanasjew
1ded40a744 exceptions: add FormulaClassUnavailableError 2016-04-17 21:16:01 +02:00
ilovezfs
fad235d8e8 tap: support --full even if installed
Makes `tap` re-runnable and unshallows when requested with `--full`.
Tapping with a different URL raises an exception.

The homebrew/core tap cannot be untapped with `untap` so running
`brew tap --full homebrew/core` is now a built-in way to get a full
clone of this tap without resorting to workarounds.

Closes #17.

Signed-off-by: ilovezfs <ilovezfs@icloud.com>
2016-04-05 07:25:27 -07:00
Xu Cheng
bc19a47eb9 GitHub: fix issues/pr searching
Closes #6.
2016-04-04 02:00:21 +08:00
Xu Cheng
00ae49f4ac BuildError: update for core/formula separation 2016-04-03 21:46:20 +08:00
ilovezfs
cc3d041c26 DSL method "apply" to specify patch files
The "apply" DSL method can be called from patch-do blocks to specify
the paths within an archive of the desired patch files, which will be
applied in the order in which they were supplied to the "apply" calls.
If "apply" isn't used, raise an error whenever the extracted directory
doesn't contain exactly one file.

The "apply" method can be called zero or more times within a patch-do
block with the following syntaxes supported:

    apply "single_apply"
    apply "multiple_apply_1", "multiple_apply_2"
    apply [array_of_apply]

If apply must be used, a single call using the second syntax above is
usually best practice. Each apply leaf should be the relative path to a
specific patch file in the extracted directory.

For example, if extracting this-v123-patches.tar.gz gives you

    this-123
    this-123/.DS_Store
    this-123/LICENSE.txt
    this-123/patches
    this-123/patches/A.diff
    this-123/patches/B.diff
    this-123/patches/C.diff
    this-123/README.txt

and you want to apply only B.diff and C.diff, then you need to use
"patches/B.diff" and "patches/C.diff" for the lowest-level apply leaves.

The code was provided by Xu Cheng. Any mistakes are mine.
2016-02-01 18:37:36 +00:00
Baptiste Fontaine
88535b09b7 exceptions: hotfix 2016-01-05 16:08:25 +01:00
Baptiste Fontaine
9f1442db14 doctor: move code away from cmd/
Closes Homebrew/homebrew#47665.

Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2016-01-05 14:33:06 +01:00
Baptiste Fontaine
c15c9dbaf3 Tap#issues_url added
Closes Homebrew/homebrew#47454.

Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2015-12-30 00:44:46 +01:00
Xu Cheng
9a384f5134 exceptions: tap is a Tap object now 2015-12-09 16:56:59 +08:00
Xu Cheng
48950f2cc0 centralize the logic of handling homebrew- in Tap.fetch
Closes Homebrew/homebrew#46537.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-12-03 13:46:59 +08:00
Baptiste Fontaine
24a1eeceb3 Common build environment methods moved in build_environment.rb
Closes Homebrew/homebrew#45966.

Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2015-11-17 00:17:22 +01:00
Xu Cheng
889bb5fb03 exceptions: add TapAlreadyTappedError 2015-11-09 15:34:20 +08:00
Xu Cheng
d6bf2f5749 run Checks#check_for_unsupported_osx unconditionally 2015-10-23 19:42:22 +08:00
Martin Afanasjew
30cad0608f os: centralize check for pre-release OS X versions
Provide `OS::Mac.prerelease?` for pre-release checks and use it where
appropriate. This should simplify updating the test once a new OS X
release lands.

This also fixes a bug in `BuildError#dump`, where an empty warning
message was printed on El Capitan after a failed from-source build,
because the check there and the one in `check_for_unsupported_osx` were
out of sync.

Closes Homebrew/homebrew#45257.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-10-23 12:34:44 +01:00
Eric Andrew Lewis
5ec396ed38 install: make search output more intuitive.
Closes Homebrew/homebrew#42222.
Closes Homebrew/homebrew#44892.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-10-19 10:16:40 +01:00
Baptiste Fontaine
f3035333fb FormulaValidationError: include full_name
Closes Homebrew/homebrew#44946.

Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2015-10-14 16:21:42 +02:00