diff options
| author | Misty De Meo | 2013-10-21 21:25:42 -0700 |
|---|---|---|
| committer | Misty De Meo | 2013-12-05 18:24:51 -0800 |
| commit | e2af1cbeeb8f68150037dbf8612b69290b9e85aa (patch) | |
| tree | 94aba370dc78c3ea5041dae7e1f159482c6be9c2 /Library/Homebrew/software_spec.rb | |
| parent | 079d0556ad0076b75f3a2eae99cf97af95a44fe2 (diff) | |
| download | brew-e2af1cbeeb8f68150037dbf8612b69290b9e85aa.tar.bz2 | |
Use BottleCollector in Bottle SoftwareSpec
Diffstat (limited to 'Library/Homebrew/software_spec.rb')
| -rw-r--r-- | Library/Homebrew/software_spec.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 4a630dbc1..288db99ca 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -4,6 +4,7 @@ require 'checksum' require 'version' require 'build_options' require 'dependency_collector' +require 'bottles' class SoftwareSpec extend Forwardable @@ -87,6 +88,7 @@ end class Bottle < SoftwareSpec attr_rw :root_url, :prefix, :cellar, :revision + attr_accessor :current_tag def_delegators :@resource, :version=, :url= @@ -103,16 +105,16 @@ class Bottle < SoftwareSpec class_eval <<-EOS, __FILE__, __LINE__ + 1 def #{cksum}(val=nil) return @#{cksum} if val.nil? - @#{cksum} ||= Hash.new + @#{cksum} ||= BottleCollector.new case val when Hash key, value = val.shift - @#{cksum}[value] = Checksum.new(:#{cksum}, key) + @#{cksum}.add(Checksum.new(:#{cksum}, key), value) end - if @#{cksum}.has_key? bottle_tag - @resource.checksum = @#{cksum}[bottle_tag] - end + cksum, current_tag = @#{cksum}.fetch_bottle_for(bottle_tag) + @resource.checksum = cksum if cksum + @current_tag = current_tag if cksum end EOS end |
