diff options
| author | Xu Cheng | 2015-05-08 18:59:08 +0800 |
|---|---|---|
| committer | Xu Cheng | 2015-05-27 13:53:40 +0800 |
| commit | 3a3a49bd93ee3a5a39019bb972a2a851ba2ab2f6 (patch) | |
| tree | f9d8968c0654d7139bb94b41c8bdcaedee9e7844 | |
| parent | 3108fb5d2258846b515959f91b5e3c74f80d3133 (diff) | |
| download | brew-3a3a49bd93ee3a5a39019bb972a2a851ba2ab2f6.tar.bz2 | |
add Formulary.core_path method, deprecate Formula.path
| -rw-r--r-- | Library/Homebrew/formula.rb | 5 | ||||
| -rw-r--r-- | Library/Homebrew/formulary.rb | 8 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_formula.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/test/testing_env.rb | 2 |
4 files changed, 12 insertions, 7 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 285b47ff4..822f17509 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -662,11 +662,12 @@ class Formula # True if this formula is provided by Homebrew itself def core_formula? - path == Formula.path(name) + path == Formulary.core_path(name) end + # @deprecated def self.path name - Pathname.new("#{HOMEBREW_LIBRARY}/Formula/#{name.downcase}.rb") + Formulary.core_path(name) end def env diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index f69912c9f..e59a25cc7 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -182,7 +182,7 @@ class Formulary class NullLoader < FormulaLoader def initialize(name) - super name, Formula.path(name) + super name, Formulary.core_path(name) end def get_formula(spec) @@ -222,7 +222,7 @@ class Formulary return FromPathLoader.new(ref) end - formula_with_that_name = Formula.path(ref) + formula_with_that_name = core_path(ref) if formula_with_that_name.file? return FormulaLoader.new(ref, formula_with_that_name) end @@ -239,4 +239,8 @@ class Formulary return NullLoader.new(ref) end + + def self.core_path(name) + Pathname.new("#{HOMEBREW_LIBRARY}/Formula/#{name.downcase}.rb") + end end diff --git a/Library/Homebrew/test/test_formula.rb b/Library/Homebrew/test/test_formula.rb index fbac07109..47f807333 100644 --- a/Library/Homebrew/test/test_formula.rb +++ b/Library/Homebrew/test/test_formula.rb @@ -5,7 +5,7 @@ class FormulaTests < Homebrew::TestCase def test_formula_instantiation klass = Class.new(Formula) { url "http://example.com/foo-1.0.tar.gz" } name = "formula_name" - path = Formula.path(name) + path = Formulary.core_path(name) spec = :stable f = klass.new(name, path, spec) @@ -174,7 +174,7 @@ class FormulaTests < Homebrew::TestCase def test_path name = 'foo-bar' - assert_equal Pathname.new("#{HOMEBREW_LIBRARY}/Formula/#{name}.rb"), Formula.path(name) + assert_equal Pathname.new("#{HOMEBREW_LIBRARY}/Formula/#{name}.rb"), Formulary.core_path(name) end def test_factory diff --git a/Library/Homebrew/test/testing_env.rb b/Library/Homebrew/test/testing_env.rb index 5f0406fb1..d960d35d5 100644 --- a/Library/Homebrew/test/testing_env.rb +++ b/Library/Homebrew/test/testing_env.rb @@ -67,7 +67,7 @@ module Homebrew TEST_SHA1 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze TEST_SHA256 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze - def formula(name="formula_name", path=Formula.path(name), spec=:stable, &block) + def formula(name="formula_name", path=Formulary.core_path(name), spec=:stable, &block) @_f = Class.new(Formula, &block).new(name, path, spec) end |
