diff options
| author | Mike McQuaid | 2012-03-18 20:37:10 +1300 |
|---|---|---|
| committer | Mike McQuaid | 2012-03-18 20:38:18 +1300 |
| commit | 64457b2315088fa8396801d04872b4da443d8961 (patch) | |
| tree | f880cd4d26a8913cb7440d75918d065aac7a4d06 /Library | |
| parent | aa91bd27d20a34ca5337639c7e97d7a38e048bd7 (diff) | |
| download | brew-64457b2315088fa8396801d04872b4da443d8961.tar.bz2 | |
Remove reliance of bottle DSL on EOCLASS.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/bottles.rb | 6 | ||||
| -rwxr-xr-x | Library/Homebrew/cmd/bottle.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/formula.rb | 47 |
3 files changed, 31 insertions, 24 deletions
diff --git a/Library/Homebrew/bottles.rb b/Library/Homebrew/bottles.rb index 13ed77590..50def92e5 100644 --- a/Library/Homebrew/bottles.rb +++ b/Library/Homebrew/bottles.rb @@ -46,4 +46,8 @@ end def old_bottle_regex /(-bottle\.tar\.gz)$/ -end
\ No newline at end of file +end + +def bottle_base_url + "https://downloads.sf.net/project/machomebrew/Bottles/" +end diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb index 4a1cd0f36..2ca0b8725 100755 --- a/Library/Homebrew/cmd/bottle.rb +++ b/Library/Homebrew/cmd/bottle.rb @@ -17,7 +17,7 @@ module Homebrew extend self safe_system 'tar', 'czf', directory/filename, "#{f.name}/#{f.version}" puts "./#{filename}" puts "bottle do" - puts " url 'https://downloads.sf.net/project/machomebrew/Bottles/#{filename}'" + puts " url '#{bottle_base_url}#{filename}'" puts " sha1 '#{(directory/filename).sha1}'" puts "end" end diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 50f733468..6604bdad3 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -651,32 +651,35 @@ private end def bottle url=nil, &block - if block_given? - eval <<-EOCLASS - module BottleData - def self.url url; @url = url; end - def self.sha1 sha1 - case sha1 - when Hash - key, value = sha1.shift - @sha1 = key if value == MacOS.cat - when String - @sha1 = sha1 - end + return unless block_given? + + bottle_block = Class.new do + def self.url url + @url = url + end + + def self.sha1 sha1 + case sha1 + when Hash + key, value = sha1.shift + @sha1 = key if value == MacOS.cat + when String + @sha1 = sha1 end - def self.return_data - if @sha1 && @url - [@url,@sha1] - elsif @sha1 - [nil,@sha1] - end + end + + def self.url_sha1 + if @sha1 && @url + return @url, @sha1 + elsif @sha1 + return nil, @sha1 end end - EOCLASS - BottleData.instance_eval &block - @bottle_url, @bottle_sha1 = BottleData.return_data - @bottle_url ||= "https://downloads.sf.net/project/machomebrew/Bottles/#{name.downcase}-#{@version||@standard.detect_version}.bottle-#{MacOS.cat}.tar.gz" if @bottle_sha1 end + + bottle_block.instance_eval &block + @bottle_url, @bottle_sha1 = bottle_block.url_sha1 + @bottle_url ||= "#{bottle_base_url}/#{name.downcase}-#{@version||@standard.detect_version}#{bottle_native_suffix}" if @bottle_sha1 end def mirror val, specs=nil |
