aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMisty De Meo2012-08-11 16:51:05 -0500
committerMisty De Meo2012-08-11 16:54:03 -0500
commitd1c0d4c8793d6ea80f1e9dd3759aa22eb506211a (patch)
treee39fe9992e4441d305f2a263d18deeedf67ddcd5
parent5882ae901f6ec7998d2961052bdb30f29696f987 (diff)
downloadbrew-d1c0d4c8793d6ea80f1e9dd3759aa22eb506211a.tar.bz2
Fix normalization of old- and new-style options
When combining the set of old-style and new-style options, make sure that the leading "--" is stripped. Fixes displaying options in `brew options`, and the exotic case of declaring options using the old syntax and then checking them with `build.include?`
-rw-r--r--Library/Homebrew/cmd/options.rb3
-rw-r--r--Library/Homebrew/formula.rb5
2 files changed, 5 insertions, 3 deletions
diff --git a/Library/Homebrew/cmd/options.rb b/Library/Homebrew/cmd/options.rb
index 040c4a74b..530c88167 100644
--- a/Library/Homebrew/cmd/options.rb
+++ b/Library/Homebrew/cmd/options.rb
@@ -32,8 +32,7 @@ module Homebrew extend self
def dump_options_for_formula f
f.build.each do |k,v|
- k.prepend "--" unless k.start_with? "--"
- puts k
+ puts "--"+k
puts "\t"+v
end
end
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 9cf1660dd..710a084c1 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -58,7 +58,10 @@ class Formula
@downloader = download_strategy.new(name, @active_spec)
# Combine DSL `option` and `def options`
- options.each {|o| self.class.build.add(o[0], o[1]) }
+ options.each do |opt, desc|
+ # make sure to strip "--" from the start of options
+ self.class.build.add opt[/--(.+)$/, 1], desc
+ end
end
def url; @active_spec.url; end