Commit Graph
23 Commits
Author SHA1 Message Date
Adam Vandenberg 4b014a4ed1 Consolidate sudo checks.
Closes #20318.
2013-06-08 20:44:56 -07:00
Jack Nagel dbe6134a0a link: extract keg-only check into a helper method 2013-05-20 21:55:01 -05:00
Jack Nagel 0e8ed301a5 link: eliminate naked rescue 2013-04-10 12:02:35 -05:00
Jack Nagel b7884284c2 Fix another handful of warnings 2013-04-06 00:14:03 -05:00
Adam Vandenberg 7581bd843a Only check keg-only if we map to a formula 2013-01-29 20:45:33 -08:00
Adam Vandenberg dd5ea24d48 Require --force to link keg-only.
Closes #13349.
2013-01-29 20:31:33 -08:00
Jack Nagel f82ed2f33d 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 84b7a15d10 Add relinking instructions.
Closes #15488.
2012-10-22 12:27:17 -07:00
Misty De Meo f52ebe5fc7 brew ln --force is now brew ln --overwrite
* Renames --force to --overwrite, freeing up brew ln --force for #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 2f8f17f133 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 40a944e58f use keg.linked? 2012-07-11 20:13:46 -07:00
Misty De Meo c3285f69b0 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 #12898.

Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
2012-07-09 12:01:09 -05:00
Misty De Meo bf051054b6 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 #11811.

Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
2012-07-09 12:01:09 -05:00
Jack Nagel dcdc678920 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 45710770a3 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 #11050 from occurring.
2012-03-19 12:24:13 +00:00
Max Howell ce082c167c 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 635ce6f5e7 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 60e85f0e8a Don't allow brew link to be run as sudo 2012-03-04 02:47:53 +00:00
Jack Nagel bc14dcf976 Warn the user of required arguments
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-04 00:27:05 -06:00
Jack Nagel 7e6dd757e2 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 179bad1b1d Fix keg exception pretty output 2011-08-24 22:30:43 +01:00
Max Howell f78fb38689 Specify that they are symlinks 2011-08-22 10:26:01 +01:00
Max Howell 9afc85ad33 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