aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2014-08-10 21:45:23 -0500
committerJack Nagel2014-08-10 21:45:23 -0500
commitd122ae8eea053b6f1074c34ce55ebc3dc26e0801 (patch)
tree7f6ad60017865fad4824f53a6c33a80ee870548c /Library
parentf306e56d214587b5ef6f6b5505b34280da19a075 (diff)
downloadbrew-d122ae8eea053b6f1074c34ce55ebc3dc26e0801.tar.bz2
Handle legacy options in the method_added hook
We only need to process the legacy options at load time, not each time the class is instantiated, and only when there is an options method defined.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formula.rb12
-rw-r--r--Library/Homebrew/software_spec.rb4
2 files changed, 8 insertions, 8 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 7b591066c..78d3a568e 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -37,7 +37,6 @@ class Formula
@active_spec = determine_active_spec(spec)
validate_attributes :url, :name, :version
- active_spec.add_legacy_options(options)
@pkg_version = PkgVersion.new(version, revision)
@pin = FormulaPin.new(self)
end
@@ -213,9 +212,6 @@ class Formula
# tell the user about any caveats regarding this package, return a string
def caveats; nil end
- # any e.g. configure options for this package
- def options; [] end
-
# Deprecated
DATA = :DATA
def patches; {} end
@@ -592,6 +588,14 @@ class Formula
raise "You cannot override Formula#brew in class #{name}"
when :test
@test_defined = true
+ when :options
+ instance = allocate
+
+ specs.each do |spec|
+ instance.options.each do |opt, desc|
+ spec.options << Option.new(opt[/^--(.+)$/, 1], desc)
+ end
+ end
end
end
diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb
index 867d10393..c595a4596 100644
--- a/Library/Homebrew/software_spec.rb
+++ b/Library/Homebrew/software_spec.rb
@@ -127,10 +127,6 @@ class SoftwareSpec
options << Option.new("without-#{name}", "Build without #{name} support")
end
end
-
- def add_legacy_options(list)
- list.each { |opt, desc| options << Option.new(opt[/^--(.+)$/, 1], desc) }
- end
end
class HeadSoftwareSpec < SoftwareSpec