| 
									
										
										
										
											2012-06-11 12:57:51 -07:00
										 |  |  | require 'formula' | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:28 -06:00
										 |  |  | require 'tab' | 
					
						
							| 
									
										
										
										
											2012-06-11 12:57:51 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-18 22:41:47 -05:00
										 |  |  | module Homebrew | 
					
						
							| 
									
										
										
										
											2012-08-14 11:57:10 -05:00
										 |  |  |   def missing_deps ff | 
					
						
							|  |  |  |     missing = {} | 
					
						
							|  |  |  |     ff.each do |f| | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:28 -06:00
										 |  |  |       missing_deps = f.recursive_dependencies do |dependent, dep| | 
					
						
							|  |  |  |         if dep.optional? || dep.recommended? | 
					
						
							|  |  |  |           tab = Tab.for_formula(dependent) | 
					
						
							| 
									
										
										
										
											2014-10-09 00:20:15 -05:00
										 |  |  |           Dependency.prune unless tab.with?(dep) | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:28 -06:00
										 |  |  |         elsif dep.build? | 
					
						
							|  |  |  |           Dependency.prune | 
					
						
							| 
									
										
										
										
											2012-08-14 11:57:10 -05:00
										 |  |  |         end | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:28 -06:00
										 |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       missing_deps.map!(&:to_formula) | 
					
						
							|  |  |  |       missing_deps.reject! { |d| d.rack.exist? && d.rack.subdirs.length > 0 } | 
					
						
							| 
									
										
										
										
											2012-06-11 12:57:51 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |       unless missing_deps.empty? | 
					
						
							| 
									
										
										
										
											2012-08-14 11:57:10 -05:00
										 |  |  |         yield f.name, missing_deps if block_given? | 
					
						
							|  |  |  |         missing[f.name] = missing_deps | 
					
						
							| 
									
										
										
										
											2012-06-11 12:57:51 -07:00
										 |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2012-08-14 11:57:10 -05:00
										 |  |  |     missing | 
					
						
							| 
									
										
										
										
											2012-06-11 12:57:51 -07:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def missing | 
					
						
							|  |  |  |     return unless HOMEBREW_CELLAR.exist? | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-14 11:57:10 -05:00
										 |  |  |     ff = if ARGV.named.empty? | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:28 -06:00
										 |  |  |       Formula.installed | 
					
						
							| 
									
										
										
										
											2012-06-11 12:57:51 -07:00
										 |  |  |     else | 
					
						
							|  |  |  |       ARGV.formulae | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-14 11:57:10 -05:00
										 |  |  |     missing_deps(ff) do |name, missing| | 
					
						
							|  |  |  |       print "#{name}: " if ff.size > 1
 | 
					
						
							| 
									
										
										
										
											2012-06-11 12:57:51 -07:00
										 |  |  |       puts "#{missing * ' '}" | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |