diff options
| author | Mike McQuaid | 2014-10-16 12:58:34 +0100 | 
|---|---|---|
| committer | Mike McQuaid | 2014-10-19 13:58:52 +0100 | 
| commit | da0a65356d662575c0005b70371050b8015227b2 (patch) | |
| tree | 0546ae442ce6346e03b0953b936621b63dc67da7 | |
| parent | b91b23f8d02b38dd95b47aae111a53a775e460d9 (diff) | |
| download | brew-da0a65356d662575c0005b70371050b8015227b2.tar.bz2 | |
Add DeprecatedOption class.
Used to capture options that are being renamed.
| -rw-r--r-- | Library/Homebrew/options.rb | 17 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_options.rb | 14 | 
2 files changed, 31 insertions, 0 deletions
| diff --git a/Library/Homebrew/options.rb b/Library/Homebrew/options.rb index 65be6e1f4..edeb5d870 100644 --- a/Library/Homebrew/options.rb +++ b/Library/Homebrew/options.rb @@ -32,6 +32,23 @@ class Option    end  end +class DeprecatedOption +  attr_reader :old, :current + +  def initialize(old, current) +    @old = old +    @current = current +  end + +  def old_flag +    "--#{old}" +  end + +  def current_flag +    "--#{current}" +  end +end +  class Options    include Enumerable diff --git a/Library/Homebrew/test/test_options.rb b/Library/Homebrew/test/test_options.rb index 73ff2b752..1bd5ba3b0 100644 --- a/Library/Homebrew/test/test_options.rb +++ b/Library/Homebrew/test/test_options.rb @@ -25,6 +25,20 @@ class OptionTests < Homebrew::TestCase    end  end +class DeprecatedOptionTests < Homebrew::TestCase +  def setup +    @deprecated_option = DeprecatedOption.new("foo", "bar") +  end + +  def test_old +    assert_equal "foo", @deprecated_option.old +  end + +  def test_current +    assert_equal "bar", @deprecated_option.current +  end +end +  class OptionsTests < Homebrew::TestCase    def setup      @options = Options.new | 
