45 Commits

Author SHA1 Message Date
Andrew Janke
8b55cb5ecb Refactor commands to remove "require cmd/help" 2018-06-07 04:59:59 -04:00
Markus Reiter
9bee9ca575 Use “squiggly” heredocs. 2017-10-18 14:39:09 +02:00
Mike McQuaid
7a38bab333 Fixup all RuboCop warnings. 2017-05-29 18:43:18 +01:00
Mike McQuaid
ba3c46d24f More deprecations.
Deprecate more methods. Internal APIs have been verified to be unused
elsewhere and removed. External APIs have had deprecation methods added.
Existing deprecations have been either upgraded to produce warnings or
no longer deprecated and the reasoning documented.
2017-04-22 16:28:07 +01:00
Mike McQuaid
566d3cb58b Document all short flags. 2017-04-02 10:14:58 +01:00
Eugene Nikolsky
edd9a9717c Fix the 'export PATH' message in link for a keg-only formula
Commit 4cae6a724e6d684eb157dd6d7328755694f228b2 introduced the message,
but it printed the wrong path, e.g. for `brew link sqlite`:

```
If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/sqlite:$PATH"' >> ~/.zshrc/bin
```

where `/bin` is appended at the end, but should be inserted before
`:$PATH`: `echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.zshrc`.
This patch fixes that and updates a test to verify it.
2017-04-01 20:12:00 -07:00
Mike McQuaid
4cae6a724e link: tell users of brew link --force about opt.
If people are force-linking keg-only things they should probably be told
that they can add the opt prefix to their PATH instead.
2017-03-23 08:42:29 +00:00
Markus Reiter
c36f42ce95 Remove private_class_method from commands. 2016-10-02 00:24:47 +02:00
Markus Reiter
0ab750bf24 Use module_function for commands. 2016-10-02 00:24:47 +02:00
Mike McQuaid
3e5ccaf3d2 link: don't allow more openssl/libressl linkage.
This extends the approach in #597 to further prevent linkage of formulae
that conflict with the system OpenSSL and can cause the issues
described in that issue.
2016-07-31 19:12:20 +01:00
Mike McQuaid
b999edb344 link: don't link /usr/local openssl.
See https://langui.sh/2015/07/24/osx-clang-include-lib-search-paths/ for
an explanation and https://gist.github.com/tdsmith/4b502c5cc6e7d358acdf
for reproduction instructions.
2016-07-29 17:00:51 -06:00
Max Nordlund
fa1fd70a37 Add all the top level comments 2016-04-10 22:59:25 +02:00
Xu Cheng
ee332c4550 handle TapFormulaWithOldnameAmbiguityError
Closes Homebrew/homebrew#44705.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-10-08 16:02:33 +08:00
BrewTestBot
13d544e11e Core files style updates.
Closes Homebrew/homebrew#42354.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-03 13:22:35 +01:00
Xu Cheng
fb8548cae5 link: load formula from rack 2015-05-27 13:53:41 +08:00
Jack Nagel
3d69e5ab7b Rename Keg#fname to Keg#name 2014-06-24 19:09:09 -05:00
Jack Nagel
4d9d01893e Move deprecated Formula class methods to compat
These have all been moved to Formulary.
2014-06-22 15:03:17 -05:00
Jack Nagel
10a1952d2c Only "extend self" once on the Homebrew module 2014-06-19 13:10:36 -05:00
Jack Nagel
72d83adaf3 Adjust link command for updated error handling 2014-04-21 12:43:06 -05:00
Jack Nagel
1f0d424459 link: fix output ordering when exceptions are raised 2014-03-27 16:27:46 -05:00
Jack Nagel
3a48d7ab9b link: print wrapper is not always required 2014-03-27 16:27:46 -05:00
Jack Nagel
714bfee8d9 Add missing newline to link and unlink in verbose mode 2014-03-26 21:53:34 -05:00
Adam Vandenberg
4c9ac19e87 Consolidate sudo checks.
Closes Homebrew/homebrew#20318.
2013-06-08 20:44:56 -07:00
Jack Nagel
92b6bcb77d link: extract keg-only check into a helper method 2013-05-20 21:55:01 -05:00
Jack Nagel
951b09b1c5 link: eliminate naked rescue 2013-04-10 12:02:35 -05:00
Jack Nagel
aa58a404ed Fix another handful of warnings 2013-04-06 00:14:03 -05:00
Adam Vandenberg
0dec35e7b0 Only check keg-only if we map to a formula 2013-01-29 20:45:33 -08:00
Adam Vandenberg
40c339e349 Require --force to link keg-only.
Closes Homebrew/homebrew#13349.
2013-01-29 20:31:33 -08:00
Jack Nagel
37a56fa513 FormulaInstaller: implement installation locks
FormulaInstaller now attempts to take a lock on a "foo.brewing" file for
the formula and all of its dependencies before attempting installation.

The lock is an advisory lock implemented using flock(), and as such it
only locks out other processes that attempt to take the lock. It also
means that it is never necessary to manually remove the lock file,
because the lock is not enforced by I/O.

The uninstall, link, and unlink commands all learn to respect this lock
as well, so that the installation cannot be corrupted by a concurrent
Homebrew process, and keg operations cannot occur simultaneously.
2013-01-26 12:14:45 -06:00
Adam Vandenberg
e99ca2d59f Add relinking instructions.
Closes Homebrew/homebrew#15488.
2012-10-22 12:27:17 -07:00
Misty De Meo
447f78c0d2 brew ln --force is now brew ln --overwrite
* Renames --force to --overwrite, freeing up brew ln --force for Homebrew/homebrew#13349
* Changes --dry-run to preview linking by default, rather than
  overwriting. An overwrite dry-run can be simulated via both
  --dry-run --overwrite
* Adds some basic Keg tests
2012-10-20 21:00:46 -05:00
Max Howell
45b84df1bd Be more verbose when users insist on being sudoers
If you google for "Cowardly refusing to sudo brew" you get a lot of confused users who didn't read any of the Homebrew documentation and then had a hissy-fit.
2012-08-10 09:33:44 -04:00
Adam Vandenberg
1b37ed4269 use keg.linked? 2012-07-11 20:13:46 -07:00
Misty De Meo
f17429f842 ARGV: add .dry_run? method
Add an ARGV.dry_run? helper method for '--dry-run'/'-n' now that
'-n' is being used as a git-style dry-run in two commands.

Closes Homebrew/homebrew#12898.

Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
2012-07-09 12:01:09 -05:00
Misty De Meo
743b5e6feb link: add --force and --dry-run options
`brew link` can now be made to delete any conflicting files using
the --force argument. It also has a --dry-run option, similar to
git clean -n, which will list any files which would be deleted
without touching the filesystem.

Closes Homebrew/homebrew#11811.

Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
2012-07-09 12:01:09 -05:00
Jack Nagel
ed83fa609b Remove broken puts from verbose brew link
The print wrapper which has its own `puts` broke this line; though with
the changes to `link` it isn't necessary any longer, so just remove it.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-03-20 11:24:35 -05:00
Max Howell
88118b51b2 Don't error if exact link already exists
If the link already exists exactly (well almost exactly) as we are about to correct it, then it's okay. Otherwise we error out. This is a safe choice, and really, the correct choice too.

This will prevent the tickets like Homebrew/homebrew#11050 from occurring.
2012-03-19 12:24:13 +00:00
Max Howell
c3370c48ce Better error when linking fails
Refs http://stackoverflow.com/questions/9762943

The system ln no longer outputs anything. Though the user can force its output with a --verbose of course. So in cases where it's not the usual of: not writable or existing file, we can ask the user to run with --verbose. I don't particularly like hiding its output, but it just confused the error IMO since it is creating a relative symlink the output was weird every time I've seen it in tickets.

I made a print wrapper so that the brew-link output doesn't get mucked up if an exception is thrown.
2012-03-19 00:28:38 +00:00
Max Howell
765ae96180 Leave kegs keg-only if linking step fails
Rationale: well, it should always have been like this!

However now we are opening ourselves up to more-mixed installations of formula not maintained by us, it's important that
2012-03-16 21:06:16 +00:00
Max Howell
f7d7fb1e81 Don't allow brew link to be run as sudo 2012-03-04 02:47:53 +00:00
Jack Nagel
1a3a1249bf Warn the user of required arguments
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-04 00:27:05 -06:00
Jack Nagel
59458eac51 link: add missing newline in verbose mode
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-01 22:52:14 -06:00
Max Howell
1f95b07ba5 Fix keg exception pretty output 2011-08-24 22:30:43 +01:00
Max Howell
471dc987e5 Specify that they are symlinks 2011-08-22 10:26:01 +01:00
Max Howell
768910283a Refactor the brew command into one file per command
The code was sucking. To the extent that maintenance was hard. It's a lot
easier to work with code that is sensibly split at sensible boundaries. So
now it is more like that.

But the refactor is minimal. Because we don't want you to have more merge
hell than absolutely necessary.

If you merge you will need to pay attention to brew.h.rb (as it is deleted)
and bin/brew (as command logic is gone). It will be painful, but you will just
have to help git out by moving any changes around manually.

Note compatibility.rb. It ensures that any function renames or removals don't
break anything. We're pretty serious about backwards compatibility. And that's
because we encourage you to hack around with the innards. And we couldn't do
that if we would then just make stuff disappear behind your back.
2011-03-12 11:55:02 -08:00