aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2013-06-23 12:47:10 -0700
committerAdam Vandenberg2013-06-29 16:44:45 -0700
commit5c27f0ccb98e413b8b836160333c06d136c9a937 (patch)
tree8a23deb744ba8a3488aa9ff8f2d25dd209437489 /Library
parentc2a5e3608ca435a969f62b2fa28722c3a1a106f0 (diff)
downloadbrew-5c27f0ccb98e413b8b836160333c06d136c9a937.tar.bz2
Formulary.factory always expects a string
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formulary.rb28
1 files changed, 8 insertions, 20 deletions
diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb
index eb86a1fb8..16e766fdd 100644
--- a/Library/Homebrew/formulary.rb
+++ b/Library/Homebrew/formulary.rb
@@ -1,5 +1,4 @@
-# The Formulary is responsible for creating instances
-# of Formula.
+# The Formulary is responsible for creating instances of Formula.
class Formulary
def self.formula_class_defined? formula_name
@@ -34,7 +33,6 @@ class Formulary
# have a "no such formula" message.
raise
rescue LoadError, NameError
- # TODO - show exception details
raise FormulaUnavailableError.new(name)
end
end
@@ -99,13 +97,13 @@ class Formulary
end
end
- # Loads formulae from URLs.
+ # Loads formulae from URLs
class FromUrlLoader < FormulaLoader
attr_reader :url
def initialize url
@url = url
- @path = (HOMEBREW_CACHE_FORMULA/(File.basename(url)))
+ @path = HOMEBREW_CACHE_FORMULA/File.basename(url)
@name = File.basename(url, '.rb')
end
@@ -136,22 +134,12 @@ class Formulary
end
# Return a Formula instance for the given reference.
- # `ref` may be:
- # * a Formula instance, in which case it is returned
- # TODO: is this code path used?
- # * a Pathname to a local formula
- # * a string containing a formula pathname
- # * a string containing a formula URL
- # * a string containing a formula name
- # * a string containing a local bottle reference
+ # `ref` is string containing:
+ # * a formula name
+ # * a formula pathname
+ # * a formula URL
+ # * a local bottle reference
def self.factory ref
- # If an instance of Formula is passed, just return it
- return ref if ref.kind_of? Formula
-
- # Otherwise, convert to String in case a Pathname comes in
- # TODO - do we call with a Pathname instead of a string anywhere?
- ref = ref.to_s
-
# If a URL is passed, download to the cache and install
if ref =~ %r[(https?|ftp)://]
f = FromUrlLoader.new(ref)