57 Commits

Author SHA1 Message Date
Jack Nagel
ba48d8c5b9 Use version attribute directly in cache comparisons
The bug that prompted the two relevant commits has since been addressed.

Squashed commit of the following:

commit ecca17ede8324efd1175a42300ace8e1e2df30fa
Author: Jack Nagel <jacknagel@gmail.com>
Date:   Sat Dec 27 16:16:12 2014 -0500

    Revert "Don't use pkg_version when cleaning the cache"

    This reverts commit 4d511b5169d78a5d44bbf6c36c17f0c28014a614.

commit e8935de08f6440ae1874ce523f93b19da6b68df3
Author: Jack Nagel <jacknagel@gmail.com>
Date:   Sat Dec 27 16:16:12 2014 -0500

    Revert "Fix cleanup for head-only formulae"

    This reverts commit 510267ffd314c296c0b0969dd27d130a249f16e2.
2014-12-27 16:16:16 -05:00
Jack Nagel
8c0928ccca Use quiet_system to avoid the shell 2014-12-16 15:27:36 -05:00
Mike McQuaid
b6c2c8cdc8 cleanup: only clean cache if it exists.
Closes Homebrew/homebrew#33297.
2014-10-19 12:28:32 +01:00
Jack Nagel
def6b1eaf7 Use Keg#uninstall to clean up kegs 2014-06-24 09:56:37 -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
Adam Vandenberg
2cb923649c only clean logs if logs exist
Closes Homebrew/homebrew#29355.
2014-05-17 16:59:14 -07:00
Jack Nagel
d6483c963a cleanup: prune old build logs
Closes Homebrew/homebrew#29231.
2014-05-14 14:36:34 -05:00
Jack Nagel
543f2a68e9 Don't send, just call the method directly 2014-03-22 13:16:16 -05:00
Jack Nagel
037acb81c8 Fix cleanup for head-only formulae
Fixes Homebrew/homebrew#27265.
2014-03-06 09:50:44 -06:00
Jack Nagel
bacf5d7137 Don't use pkg_version when cleaning the cache
Fixes Homebrew/homebrew#27245.
2014-03-05 21:45:07 -06:00
Jack Nagel
17032a600c Teach commands to work with revisions 2014-03-05 20:12:51 -06:00
Jack Nagel
c0eb1f10de Don't clean up lockfiles if the directory doesn't exist
Fixes Homebrew/homebrew#20673.
2013-06-21 18:38:39 -05:00
Jack Nagel
3b56cb02ea Clean up lockfiles 2013-06-21 15:42:14 -05:00
Jack Nagel
9a741810c8 cleanup: use String#[] instead of "captures.first rescue nil" 2013-06-06 12:34:47 -05:00
Jack Nagel
277f3d3c30 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 Homebrew/homebrew#19863.
2013-05-18 20:22:24 -05:00
Jack Nagel
d3a8cb7803 cleanup: enable prune during dry-run mode
Closes Homebrew/homebrew#19826.
2013-05-15 12:57:02 -05:00
Jack Nagel
f4dcdea64e cleanup: cleanup_all => cleanup_cellar 2013-05-15 12:57:01 -05:00
Jack Nagel
a9fcefda4e cleanup: refactor cleanup_cache 2013-05-15 12:57:01 -05:00
Jack Nagel
5b5bb57865 cleanup: rename variable 2013-05-15 12:57:00 -05:00
Jack Nagel
b26c502f79 cleanup: refactor cleanup_formula 2013-05-15 12:57:00 -05:00
Jack Nagel
87a8f9a6ae cleanup: only map dirs to kegs once 2013-05-15 12:57:00 -05:00
Jack Nagel
daf8c26108 cleanup: use Pathname#rmtree instead of FileUtils 2013-05-15 12:56:59 -05:00
Jack Nagel
b32310c3db cleanup: use subdirs, avoid .directory? checks 2013-05-15 12:56:59 -05:00
Jack Nagel
bf8bf2e1d1 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
0c35274bf4 cleanup: rename method for consistency 2013-05-15 12:56:58 -05:00
Jack Nagel
5515d359d5 cleanup: use early return rather than method-spanning conditional 2013-05-15 12:56:58 -05:00
Jack Nagel
8cd331718e cleanup: factor out unqualified cleanup code 2013-05-15 12:56:58 -05:00
Jack Nagel
c48ac0b982 Methods that end in _formula should only accept a formula 2013-05-15 12:56:57 -05:00
Mike McQuaid
c8335d9c46 cleanup: don't remove old incomplete files twice. 2013-03-02 08:56:58 +00:00
Jack Nagel
1a799f04e6 Remove unused variables 2013-02-18 12:13:35 -06:00
Simon Sigurdhsson
af3bfab9db 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 Homebrew/homebrew#13953.

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

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

Closes Homebrew/homebrew#16356.
Closes Homebrew/homebrew#16388.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2012-12-04 11:40:38 +00:00
Xiyue Deng
2a1ec18ff9 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 Homebrew/homebrew#15914.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2012-11-30 21:37:56 +00:00
Max Howell
4973329a60 brew cleanup -n: less scary 2012-09-22 00:29:17 -04:00
Jack Nagel
5ebf0416ce 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
1c22f03850 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
d5299f4946 cleanup: allow --force to remove keg-only brews again
Fixes Homebrew/homebrew#14840.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-09-11 14:29:33 -05:00
Max Howell
05b91e3d29 Figure out if we can cleanup keg-only kegs 2012-08-29 12:41:33 -04:00
Max Howell
ad80c616b8 brew cleanup removes .DS_Store files
Probably slow, but we hate these fuckers.
2012-08-13 10:14:59 -04: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
Mike McQuaid
a1ce504e7d Cleanup old bottles. 2012-04-30 21:37:58 +08:00
Max Howell
981605d199 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 Homebrew/homebrew#2923.
2012-03-09 15:25:09 +00:00
Max Howell
4e3c99d96f Don't attempt to cleanup source checkouts
Fixes Homebrew/homebrew#10751.
2012-03-07 17:14:06 +00:00
Max Howell
158efd8c9a 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 Homebrew/homebrew#2923.
2012-03-06 20:28:06 +00:00
Jack Nagel
0cc3eb296d 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