Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Commit

Permalink
Add sample external commands: dirty, leaves, options
Browse files Browse the repository at this point in the history
  • Loading branch information
adamv committed Jun 8, 2010
1 parent fafcaae commit 3d933c3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Library/Contributions/examples/brew-dirty.rb
Original file line number Diff line number Diff line change
@@ -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 changes: 9 additions & 0 deletions Library/Contributions/examples/brew-leaves.rb
Original file line number Diff line number Diff line change
@@ -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 changes: 9 additions & 0 deletions Library/Contributions/examples/brew-options.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3d933c3

Please sign in to comment.