diff options
| author | Jack Nagel | 2014-06-19 21:35:46 -0500 | 
|---|---|---|
| committer | Jack Nagel | 2014-06-20 21:32:36 -0500 | 
| commit | 56c89c48b9a4b6cd57fd9b7bec2da11fc9faa24a (patch) | |
| tree | 0cb25626580ef6b4b48d484821e6b7f9f489b15c | |
| parent | 7eb0d525ae1550163024a5dfa7b5b46dd3211049 (diff) | |
| download | homebrew-56c89c48b9a4b6cd57fd9b7bec2da11fc9faa24a.tar.bz2 | |
Pass the requested spec into the formula instance
| -rw-r--r-- | Library/Homebrew/formula.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/formulary.rb | 14 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_formula.rb | 5 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_formula_install.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/testball.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/testing_env.rb | 4 | 
6 files changed, 15 insertions, 14 deletions
| diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 66bf75d17..93170ef64 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -26,7 +26,7 @@ class Formula    attr_accessor :local_bottle_path -  def initialize(name, path) +  def initialize(name, path, spec)      @name = name      @path = path      @homepage = self.class.homepage diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index da64a43e5..f4fb6bf1b 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -46,8 +46,8 @@ class Formulary      end      # Gets the formula instance. -    def get_formula -      klass.new(name, path) +    def get_formula(spec) +      klass.new(name, path, spec)      end      # Return the Class for this formula, `require`-ing it if @@ -98,7 +98,7 @@ class Formulary        super name, Formula.path(name)      end -    def get_formula +    def get_formula(spec)        formula = super        formula.local_bottle_path = @bottle_filename        formula @@ -154,7 +154,7 @@ class Formulary        end      end -    def get_formula +    def get_formula(spec)        fetch        super      end @@ -181,7 +181,7 @@ class Formulary        super name, path      end -    def get_formula +    def get_formula(spec)        super      rescue FormulaUnavailableError        raise TapFormulaUnavailableError.new(tapped_name) @@ -194,8 +194,8 @@ class Formulary    # * a formula pathname    # * a formula URL    # * a local bottle reference -  def self.factory ref -    loader_for(ref).get_formula +  def self.factory(ref, spec=:stable) +    loader_for(ref).get_formula(spec)    end    def self.canonical_name(ref) diff --git a/Library/Homebrew/test/test_formula.rb b/Library/Homebrew/test/test_formula.rb index aba8ef377..c4a9c1587 100644 --- a/Library/Homebrew/test/test_formula.rb +++ b/Library/Homebrew/test/test_formula.rb @@ -6,8 +6,9 @@ class FormulaTests < Homebrew::TestCase      klass = Class.new(Formula) { url "http://example.com/foo-1.0.tar.gz" }      name = "formula_name"      path = Formula.path(name) +    spec = :stable -    f = klass.new(name, path) +    f = klass.new(name, path, spec)      assert_equal name, f.name      assert_equal path, f.path      assert_raises(ArgumentError) { klass.new } @@ -168,7 +169,7 @@ class FormulaTests < Homebrew::TestCase        bottle { sha1 TEST_SHA1 => bottle_tag }        def initialize -        super "test", Pathname.new(__FILE__).expand_path +        super "test", Pathname.new(__FILE__).expand_path, :stable        end      end.new diff --git a/Library/Homebrew/test/test_formula_install.rb b/Library/Homebrew/test/test_formula_install.rb index 8cd11045e..0ec094875 100644 --- a/Library/Homebrew/test/test_formula_install.rb +++ b/Library/Homebrew/test/test_formula_install.rb @@ -59,7 +59,7 @@ class InstallTests < Homebrew::TestCase        url "file://#{File.expand_path(__FILE__)}"        version "1"        def initialize -        super "test_script_formula", Pathname.new(__FILE__).expand_path +        super "test_script_formula", Pathname.new(__FILE__).expand_path, :stable        end      end.new diff --git a/Library/Homebrew/test/testball.rb b/Library/Homebrew/test/testball.rb index d2686ba85..4bb8df773 100644 --- a/Library/Homebrew/test/testball.rb +++ b/Library/Homebrew/test/testball.rb @@ -1,7 +1,7 @@  require 'formula'  class TestBall < Formula -  def initialize(name="test_ball", path=Pathname.new(__FILE__).expand_path) +  def initialize(name="test_ball", path=Pathname.new(__FILE__).expand_path, spec=:stable)      self.class.instance_eval do        stable.url "file://#{TEST_DIRECTORY}/tarballs/testball-0.1.tbz"        stable.sha1 "482e737739d946b7c8cbaf127d9ee9c148b999f5" diff --git a/Library/Homebrew/test/testing_env.rb b/Library/Homebrew/test/testing_env.rb index b675ee38e..45d2f7d18 100644 --- a/Library/Homebrew/test/testing_env.rb +++ b/Library/Homebrew/test/testing_env.rb @@ -95,8 +95,8 @@ module Homebrew      TEST_SHA1   = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze      TEST_SHA256 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze -    def formula(name="formula_name", path=Formula.path(name), &block) -      @_f = Class.new(Formula, &block).new(name, path) +    def formula(name="formula_name", path=Formula.path(name), spec=:stable, &block) +      @_f = Class.new(Formula, &block).new(name, path, spec)      end      def shutup | 
