aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2014-04-05 22:03:33 -0500
committerJack Nagel2014-04-05 22:03:39 -0500
commite008ceb332ddf88a8079d504adebaaead215a4ec (patch)
treefc76a23b236cd21c10c102024cbdb204507558bc /Library
parentca3688e33e1b98e67242e87a6b067b696f05effb (diff)
downloadbrew-e008ceb332ddf88a8079d504adebaaead215a4ec.tar.bz2
Pass path directly to StandardLoader when possible
Now we can avoid computing the path twice in the common case.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formulary.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb
index 5e0fd4d3f..5f73ebe6a 100644
--- a/Library/Homebrew/formulary.rb
+++ b/Library/Homebrew/formulary.rb
@@ -105,8 +105,8 @@ class Formulary
# Loads formulae from Homebrew's provided Library
class StandardLoader < FormulaLoader
- def initialize name
- super name, Formula.path(name)
+ def initialize name, path=Formula.path(name)
+ super
end
end
@@ -198,14 +198,15 @@ class Formulary
formula_with_that_name = Formula.path(ref)
if formula_with_that_name.file? and formula_with_that_name.readable?
- return StandardLoader.new(ref)
+ return StandardLoader.new(ref, formula_with_that_name)
end
# test if the name is a formula alias
possible_alias = Pathname.new("#{HOMEBREW_LIBRARY}/Aliases/#{ref}")
if possible_alias.file?
- name = possible_alias.resolved_path.basename(".rb").to_s
- return StandardLoader.new(name)
+ path = possible_alias.resolved_path
+ name = path.basename(".rb").to_s
+ return StandardLoader.new(name, path)
end
possible_cached_formula = Pathname.new("#{HOMEBREW_CACHE_FORMULA}/#{ref}.rb")