aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2010-06-03 15:09:20 -0700
committerAdam Vandenberg2010-06-07 21:43:20 -0700
commit89717c9d9089de1e78e49f36fda812501ce51891 (patch)
tree0a1223af6c78ec9df7e41cc7b9a878d95569a293 /Library
parentb016c2eae516c7a631a75b41b3425c24b868b796 (diff)
downloadbrew-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-xLibrary/Contributions/examples/brew-dirty.rb7
-rwxr-xr-xLibrary/Contributions/examples/brew-leaves.rb9
-rwxr-xr-xLibrary/Contributions/examples/brew-options.rb9
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