| 
									
										
										
										
											2015-08-03 13:09:07 +01:00
										 |  |  | require "cmd/tap" # for tap_args | 
					
						
							| 
									
										
										
										
											2012-03-02 20:28:54 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-18 22:41:47 -05:00
										 |  |  | module Homebrew | 
					
						
							| 
									
										
										
										
											2012-03-02 20:28:54 +00:00
										 |  |  |   def untap | 
					
						
							| 
									
										
										
										
											2013-03-02 06:52:55 -05:00
										 |  |  |     raise "Usage is `brew untap <tap-name>`" if ARGV.empty? | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-08 18:05:58 +08:00
										 |  |  |     ARGV.named.each do |tapname| | 
					
						
							|  |  |  |       tap = Tap.new(*tap_args(tapname)) | 
					
						
							| 
									
										
										
										
											2015-02-01 12:11:54 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-13 14:32:10 +08:00
										 |  |  |       raise TapUnavailableError, tap.name unless tap.installed? | 
					
						
							| 
									
										
										
										
											2015-06-08 18:05:58 +08:00
										 |  |  |       puts "Untapping #{tap}... (#{tap.path.abv})" | 
					
						
							| 
									
										
										
										
											2015-02-01 12:11:54 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-08 18:05:58 +08:00
										 |  |  |       formula_count = tap.formula_files.size | 
					
						
							|  |  |  |       tap.path.rmtree | 
					
						
							|  |  |  |       tap.path.dirname.rmdir_if_possible | 
					
						
							| 
									
										
										
										
											2015-08-03 13:09:07 +01:00
										 |  |  |       puts "Untapped #{formula_count} formula#{plural(formula_count, "e")}" | 
					
						
							| 
									
										
										
										
											2015-02-01 12:11:54 -05:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2012-03-18 00:40:41 +00:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2012-03-02 20:28:54 +00:00
										 |  |  | end |