| 
									
										
										
										
											2013-03-11 16:41:08 +01:00
										 |  |  | require 'formula' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module Homebrew extend self | 
					
						
							|  |  |  |   def pin | 
					
						
							|  |  |  |     if Process.uid.zero? and not File.stat(HOMEBREW_BREW_FILE).uid.zero? | 
					
						
							|  |  |  |       abort "Cowardly refusing to `sudo pin'" | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |     raise FormulaUnspecifiedError if ARGV.named.empty? | 
					
						
							| 
									
										
										
										
											2013-04-16 01:43:26 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ARGV.formulae.each do |f| | 
					
						
							|  |  |  |       if f.pinned? | 
					
						
							|  |  |  |         opoo "#{f.name} already pinned" | 
					
						
							|  |  |  |       elsif !f.pinnable? | 
					
						
							|  |  |  |         onoe "#{f.name} not installed" | 
					
						
							|  |  |  |       else | 
					
						
							|  |  |  |         f.pin | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2013-03-11 16:41:08 +01:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |