Commit Graph
43 Commits
Author SHA1 Message Date
Jack Nagel e88fe41795 cleanup: use String#[] instead of "captures.first rescue nil" 2013-06-06 12:34:47 -05:00
Jack Nagel 274a67e639 Stop running "prune" as part of "cleanup"
Rationale: "prune" is slow, does not need to be run as often as
"cleanup", and is potentially destructive to things like empty
directories that Homebrew did not create. Thus we should let users run
`brew prune` only when they wish to, while still being able to use `brew
cleanup`.

Closes #19863.
2013-05-18 20:22:24 -05:00
Jack Nagel 2e134437e2 cleanup: enable prune during dry-run mode
Closes #19826.
2013-05-15 12:57:02 -05:00
Jack Nagel 24acea9c76 cleanup: cleanup_all => cleanup_cellar 2013-05-15 12:57:01 -05:00
Jack Nagel 243089faf9 cleanup: refactor cleanup_cache 2013-05-15 12:57:01 -05:00
Jack Nagel 1539d8f598 cleanup: rename variable 2013-05-15 12:57:00 -05:00
Jack Nagel 3be1ac1ea9 cleanup: refactor cleanup_formula 2013-05-15 12:57:00 -05:00
Jack Nagel b02c5a82ec cleanup: only map dirs to kegs once 2013-05-15 12:57:00 -05:00
Jack Nagel 5d74f1ea3f cleanup: use Pathname#rmtree instead of FileUtils 2013-05-15 12:56:59 -05:00
Jack Nagel 2ec0fca0f7 cleanup: use subdirs, avoid .directory? checks 2013-05-15 12:56:59 -05:00
Jack Nagel 7b1d94f007 cleanup: remove redundant condition
If f.installed? is true, f.rack.directory? will always be true as well.
2013-05-15 12:56:59 -05:00
Jack Nagel bdf7913182 cleanup: rename method for consistency 2013-05-15 12:56:58 -05:00
Jack Nagel bceb8c57c8 cleanup: use early return rather than method-spanning conditional 2013-05-15 12:56:58 -05:00
Jack Nagel 717de9c6a7 cleanup: factor out unqualified cleanup code 2013-05-15 12:56:58 -05:00
Jack Nagel eb759a41ef Methods that end in _formula should only accept a formula 2013-05-15 12:56:57 -05:00
Mike McQuaid 1578e1360f cleanup: don't remove old incomplete files twice. 2013-03-02 08:56:58 +00:00
Jack Nagel 33393a2597 Remove unused variables 2013-02-18 12:13:35 -06:00
Simon Sigurdhsson 34cfc378b5 Make CurlDownloadStrategy resume aborted downloads
* `CurlDownloadStrategy#_fetch` (and the same methods in its
  subclasses) now fetches the file to a temporary path, and
  `CurlDownloadStrategy#fetch` moves it to the correct location.
* `Homebrew#cleanup` cleans the temporary files `CurlDownloadStrategy`
  creates if they're left in the cache.

Closes #13953.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-02-02 14:05:40 -08:00
Mike McQuaid f40b309fb1 brew-cleanup: don't whine about permission denied.
Closes #14359.
2013-01-26 14:11:06 +00:00
Mike Lapinsky 7f6c9e3b5e Don't remove linked formulas when doing a 'cleanup'
Closes #16947.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2013-01-08 09:50:12 -08:00
Jack Nagel abc1bd2762 cleanup: fix 1.8.6 compatibilty issue
Fixes #16655.
2012-12-19 12:00:25 -06:00
Mike McQuaid a7247b92f6 Check if Cellar and Cache exist before cleaning. 2012-12-16 19:15:18 +00:00
Xiyue Deng dc19acc2b4 brew-cleanup: check whether keg is a directory.
* Avoid problem when encountering `.DS_Store' in Cellar.

Closes #16356.
Closes #16388.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2012-12-04 11:40:38 +00:00
Xiyue Deng 1739239911 brew cleanup: don't remove higher version kegs.
* Use version compare to only remove kegs with lower version than the
  current one, not higher version which might be from someone's
  branch.
* Do the same for cache cleanup.
  - Be conservative so that if a name detected from cache file is not
    the same as its formula then don't clean it.

Closes #15914.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2012-11-30 21:37:56 +00:00
Max Howell 07a55a26bd brew cleanup -n: less scary 2012-09-22 00:29:17 -04:00
Jack Nagel e4aec6e2d7 cleanup: look for "HEAD", not "sha" in receipt
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-09-20 16:47:00 -05:00
Jack Nagel 4aa03d24be cleanup: skip rm_DS_Store during a dry run
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-09-11 14:41:01 -05:00
Jack Nagel 2957b286a8 cleanup: allow --force to remove keg-only brews again
Fixes #14840.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-09-11 14:29:33 -05:00
Max Howell 1a1bcbeaa8 Figure out if we can cleanup keg-only kegs 2012-08-29 12:41:33 -04:00
Max Howell 996636445c brew cleanup removes .DS_Store files
Probably slow, but we hate these fuckers.
2012-08-13 10:14:59 -04: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
Mike McQuaid cd4f7c10cd Cleanup old bottles. 2012-04-30 21:37:58 +08:00
Max Howell 70ae09d9c3 Don't cleanup the wrong things
This still isn't perfect, but it will handle hyphens in formula-names better now. A proper solution is not easy or maybe even possible unless we ban hyphens in versions AND formula names, or use a different character as a separate in downloaded cache files which we then ban from formula-name and version strings.

Refs #2923.
2012-03-09 15:25:09 +00:00
Max Howell bbc5fed4bb Don't attempt to cleanup source checkouts
Fixes #10751.
2012-03-07 17:14:06 +00:00
Max Howell 6da4a9a6f4 brew cleanup cleans up the download-cache
Manpage updated.

The -s switch is "scrub" and removes downloads for uninstall formula which are downloads for the latest version of that formula still.

Please NOTE cache is NOT cleaned if a formula argument is provided. I couldn't be bothered. Patches welcome :)

Closes #2923.
2012-03-06 20:28:06 +00:00
Jack Nagel bc78e2b250 cleanup: add an option to perform a 'dry run'
Sometimes you want to know what `brew cleanup` will do before it
actually removes anything. Introduce a '-n' option (chosen to match
other UNIX tools) to do this.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2011-11-07 22:46:36 -06:00
Charlie Sharpsteen 06fbecbeae Centralize definition of rack in formula.rb
`rack` is a commonly used alias for `formula.prefix.parent`---so common that it
gets defined and used quite a bit. This patch makes `rack` an official method
of the `Formula` class.
2011-09-16 08:55:38 -07:00
Max Howell 29a9dbece2 Revise cleanup text, we're removing, not uninstalling 2011-08-24 22:30:42 +01:00
Adam Vandenberg f4d21415de Add --force to brew cleanup 2011-04-18 21:11:08 -07:00
Adam Vandenberg d89a2a0b7d brew cleanup - do not clean up keg-only brews for now 2011-03-12 11:55:11 -08:00
Adam Vandenberg ca830014d8 brew cleanup - fix formula name in warning 2011-03-12 11:55:11 -08:00
Adam Vandenberg 36b307f5e0 Silence cleanup warning
When a cellar exists for an unknown formula, no longer print a warning.
External tools using Brew to manage diy-installs will create a large
number of non-formula cellars.
2011-03-12 11:55:10 -08: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