| 
									
										
										
										
											2016-04-08 16:28:43 +02:00
										 |  |  | #:  * `cleanup` [`--prune=`<days>] [`--dry-run`] [`-s`] [<formulae>]: | 
					
						
							|  |  |  | #:    For all installed or specific formulae, remove any older versions from the | 
					
						
							|  |  |  | #:    cellar. In addition, old downloads from the Homebrew download-cache are deleted. | 
					
						
							|  |  |  | #: | 
					
						
							|  |  |  | #:    If `--prune=`<days> is specified, remove all cache files older than <days>. | 
					
						
							|  |  |  | #: | 
					
						
							|  |  |  | #:    If `--dry-run` or `-n` is passed, show what would be removed, but do not | 
					
						
							|  |  |  | #:    actually remove anything. | 
					
						
							|  |  |  | #: | 
					
						
							| 
									
										
										
										
											2017-02-25 17:37:57 -05:00
										 |  |  | #:    If `-s` is passed, scrub the cache, removing downloads for even the latest | 
					
						
							| 
									
										
										
										
											2016-04-08 16:28:43 +02:00
										 |  |  | #:    versions of formulae. Note downloads for any installed formulae will still not be | 
					
						
							|  |  |  | #:    deleted. If you want to delete those too: `rm -rf $(brew --cache)` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-29 12:57:48 +01:00
										 |  |  | require "cleanup" | 
					
						
							| 
									
										
										
										
											2015-11-17 16:51:56 +05:30
										 |  |  | require "utils" | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-18 22:41:47 -05:00
										 |  |  | module Homebrew | 
					
						
							| 
									
										
										
										
											2016-09-26 01:44:51 +02:00
										 |  |  |   module_function | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  |   def cleanup | 
					
						
							|  |  |  |     if ARGV.named.empty? | 
					
						
							| 
									
										
										
										
											2015-12-29 12:57:48 +01:00
										 |  |  |       Cleanup.cleanup | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  |     else | 
					
						
							| 
									
										
										
										
											2015-12-29 12:57:48 +01:00
										 |  |  |       ARGV.resolved_formulae.each { |f| Cleanup.cleanup_formula f } | 
					
						
							| 
									
										
										
										
											2013-05-15 12:45:35 -05:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2015-11-17 16:51:56 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-22 20:12:28 +02:00
										 |  |  |     return if Cleanup.disk_cleanup_size.zero? | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     disk_space = disk_usage_readable(Cleanup.disk_cleanup_size) | 
					
						
							|  |  |  |     if ARGV.dry_run? | 
					
						
							|  |  |  |       ohai "This operation would free approximately #{disk_space} of disk space." | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |       ohai "This operation has freed approximately #{disk_space} of disk space." | 
					
						
							| 
									
										
										
										
											2015-11-17 16:51:56 +05:30
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2013-05-15 12:45:35 -05:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2012-08-10 16:33:47 -04:00
										 |  |  | end |