| 
									
										
										
										
											2012-03-07 17:29:05 -05:00
										 |  |  | require 'formula' | 
					
						
							| 
									
										
										
										
											2012-03-07 21:30:03 -05:00
										 |  |  | require 'bottles' | 
					
						
							| 
									
										
										
										
											2012-03-07 17:29:05 -05:00
										 |  |  | require 'tab' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module Homebrew extend self | 
					
						
							|  |  |  |   def bottle_formula f | 
					
						
							| 
									
										
										
										
											2012-03-15 10:57:34 +13:00
										 |  |  |     unless f.installed? | 
					
						
							| 
									
										
										
										
											2012-04-30 14:08:59 +10:00
										 |  |  |       return ofail "Formula not installed: #{f.name}" | 
					
						
							| 
									
										
										
										
											2012-03-15 10:57:34 +13:00
										 |  |  |       return | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-25 11:31:57 -07:00
										 |  |  |     unless built_as_bottle? f | 
					
						
							| 
									
										
										
										
											2012-04-30 14:08:59 +10:00
										 |  |  |       return ofail "Formula not installed with '--build-bottle': #{f.name}" | 
					
						
							| 
									
										
										
										
											2012-03-15 10:57:34 +13:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2012-03-07 17:29:05 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     directory = Pathname.pwd | 
					
						
							| 
									
										
										
										
											2012-04-03 11:43:41 -05:00
										 |  |  |     bottle_version = bottle_new_version f | 
					
						
							|  |  |  |     filename = bottle_filename f, bottle_version | 
					
						
							| 
									
										
										
										
											2012-03-07 17:29:05 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     HOMEBREW_CELLAR.cd do | 
					
						
							|  |  |  |       ohai "Bottling #{f.name} #{f.version}..." | 
					
						
							|  |  |  |       # Use gzip, faster to compress than bzip2, faster to uncompress than bzip2 | 
					
						
							|  |  |  |       # or an uncompressed tarball (and more bandwidth friendly). | 
					
						
							|  |  |  |       safe_system 'tar', 'czf', directory/filename, "#{f.name}/#{f.version}" | 
					
						
							|  |  |  |       puts "./#{filename}" | 
					
						
							|  |  |  |       puts "bottle do" | 
					
						
							| 
									
										
										
										
											2012-04-03 11:43:41 -05:00
										 |  |  |       puts "  version #{bottle_version}" if bottle_version > 0
 | 
					
						
							| 
									
										
										
										
											2012-03-29 18:41:47 +11:00
										 |  |  |       puts "  sha1 '#{(directory/filename).sha1}' => :#{MacOS.cat}" | 
					
						
							| 
									
										
										
										
											2012-03-07 17:29:05 -05:00
										 |  |  |       puts "end" | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def bottle | 
					
						
							|  |  |  |     ARGV.formulae.each do|f| | 
					
						
							|  |  |  |       bottle_formula Formula.factory f | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |