Add sample external commands: dirty, leaves, options
See: * http://github.com/mxcl/homebrew/issues/issue/1359 * http://github.com/mxcl/homebrew/issues/issue/1438
This commit is contained in:
		
							parent
							
								
									b016c2eae5
								
							
						
					
					
						commit
						89717c9d90
					
				
							
								
								
									
										7
									
								
								Library/Contributions/examples/brew-dirty.rb
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										7
									
								
								Library/Contributions/examples/brew-dirty.rb
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,7 @@
 | 
			
		||||
# See: http://github.com/mxcl/homebrew/issues/issue/1359
 | 
			
		||||
 | 
			
		||||
to_list = HOMEBREW_CELLAR.children.select { |pn| pn.directory? }
 | 
			
		||||
to_list.each do |d|
 | 
			
		||||
  versions = d.children.select { |pn| pn.directory? }.collect { |pn| pn.basename.to_s }
 | 
			
		||||
  puts "#{d.basename} (#{versions.join(', ')})" if versions.size > 1
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										9
									
								
								Library/Contributions/examples/brew-leaves.rb
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										9
									
								
								Library/Contributions/examples/brew-leaves.rb
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,9 @@
 | 
			
		||||
# See: http://github.com/mxcl/homebrew/issues/issue/1438
 | 
			
		||||
 | 
			
		||||
require 'formula'
 | 
			
		||||
deps_graph = Formula.get_used_by
 | 
			
		||||
formulas = HOMEBREW_CELLAR.children.select { |pn| pn.directory? }.collect { |pn| pn.basename.to_s }
 | 
			
		||||
formulas.each do |name|
 | 
			
		||||
  deps = deps_graph[name] || []
 | 
			
		||||
  puts name if !deps.any? { |dep| formulas.include?(dep) }
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										9
									
								
								Library/Contributions/examples/brew-options.rb
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										9
									
								
								Library/Contributions/examples/brew-options.rb
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,9 @@
 | 
			
		||||
ARGV.formulae.each do |f|
 | 
			
		||||
  f.options rescue next
 | 
			
		||||
  puts f.name
 | 
			
		||||
  f.options.each do |o|
 | 
			
		||||
    puts o[0]
 | 
			
		||||
    puts "\t"+o[1]
 | 
			
		||||
  end
 | 
			
		||||
  puts
 | 
			
		||||
end
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user