diff options
| author | Adam Vandenberg | 2010-06-03 15:09:20 -0700 |
|---|---|---|
| committer | Adam Vandenberg | 2010-06-07 21:43:20 -0700 |
| commit | 89717c9d9089de1e78e49f36fda812501ce51891 (patch) | |
| tree | 0a1223af6c78ec9df7e41cc7b9a878d95569a293 /Library | |
| parent | b016c2eae516c7a631a75b41b3425c24b868b796 (diff) | |
| download | brew-89717c9d9089de1e78e49f36fda812501ce51891.tar.bz2 | |
Add sample external commands: dirty, leaves, options
See:
* http://github.com/mxcl/homebrew/issues/issue/1359
* http://github.com/mxcl/homebrew/issues/issue/1438
Diffstat (limited to 'Library')
| -rwxr-xr-x | Library/Contributions/examples/brew-dirty.rb | 7 | ||||
| -rwxr-xr-x | Library/Contributions/examples/brew-leaves.rb | 9 | ||||
| -rwxr-xr-x | Library/Contributions/examples/brew-options.rb | 9 |
3 files changed, 25 insertions, 0 deletions
diff --git a/Library/Contributions/examples/brew-dirty.rb b/Library/Contributions/examples/brew-dirty.rb new file mode 100755 index 000000000..e22ad75c6 --- /dev/null +++ b/Library/Contributions/examples/brew-dirty.rb @@ -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 diff --git a/Library/Contributions/examples/brew-leaves.rb b/Library/Contributions/examples/brew-leaves.rb new file mode 100755 index 000000000..ba5644c55 --- /dev/null +++ b/Library/Contributions/examples/brew-leaves.rb @@ -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 diff --git a/Library/Contributions/examples/brew-options.rb b/Library/Contributions/examples/brew-options.rb new file mode 100755 index 000000000..bf7a0180a --- /dev/null +++ b/Library/Contributions/examples/brew-options.rb @@ -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 |
