From d1c0d4c8793d6ea80f1e9dd3759aa22eb506211a Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Sat, 11 Aug 2012 16:51:05 -0500 Subject: 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?` --- Library/Homebrew/cmd/options.rb | 3 +-- Library/Homebrew/formula.rb | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'Library') 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 -- cgit v1.2.3