aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/dev-cmd/formula.rb13
-rw-r--r--Library/Homebrew/test/formula_cmd_test.rb8
2 files changed, 21 insertions, 0 deletions
diff --git a/Library/Homebrew/dev-cmd/formula.rb b/Library/Homebrew/dev-cmd/formula.rb
new file mode 100644
index 000000000..71687dfa7
--- /dev/null
+++ b/Library/Homebrew/dev-cmd/formula.rb
@@ -0,0 +1,13 @@
+#: * `formula` <formula>:
+#: Display the path where <formula> is
+
+require "formula"
+
+module Homebrew
+ module_function
+
+ def formula
+ raise FormulaUnspecifiedError if ARGV.named.empty?
+ ARGV.resolved_formulae.each { |f| puts f.path }
+ end
+end
diff --git a/Library/Homebrew/test/formula_cmd_test.rb b/Library/Homebrew/test/formula_cmd_test.rb
new file mode 100644
index 000000000..abbe42d98
--- /dev/null
+++ b/Library/Homebrew/test/formula_cmd_test.rb
@@ -0,0 +1,8 @@
+require "testing_env"
+
+class IntegrationCommandTestFormula < IntegrationCommandTestCase
+ def test_formula
+ formula_file = setup_test_formula "testball"
+ assert_equal formula_file.to_s, cmd("formula", "testball")
+ end
+end