aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorJack Nagel2013-09-17 21:25:40 -0500
committerJack Nagel2013-09-17 21:29:53 -0500
commit978f0887cb38c4437678933e63f38fb0c5e40536 (patch)
treec8d8bad037d8ee474e335cca0e5debf1a66c5f20 /Library/Homebrew
parent9c7a18bdcb76630ba6649a90cbee020181eb382c (diff)
downloadbrew-978f0887cb38c4437678933e63f38fb0c5e40536.tar.bz2
Download strategies take a resource now
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/download_strategy.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index f84018eb3..f45bcc2cf 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -4,9 +4,9 @@ require 'utils/json'
class AbstractDownloadStrategy
attr_accessor :local_bottle_path
- def initialize name, package
- @url = package.url
- specs = package.specs
+ def initialize name, resource
+ @url = resource.url
+ specs = resource.specs
@spec, @ref = specs.dup.shift unless specs.empty?
end
@@ -38,16 +38,16 @@ class AbstractDownloadStrategy
end
class CurlDownloadStrategy < AbstractDownloadStrategy
- def initialize name, package
+ def initialize name, resource
super
if name.to_s.empty? || name == '__UNKNOWN__'
@tarball_path = Pathname.new("#{HOMEBREW_CACHE}/#{basename_without_params}")
else
- @tarball_path = Pathname.new("#{HOMEBREW_CACHE}/#{name}-#{package.version}#{ext}")
+ @tarball_path = Pathname.new("#{HOMEBREW_CACHE}/#{name}-#{resource.version}#{ext}")
end
- @mirrors = package.mirrors
+ @mirrors = resource.mirrors
@temporary_path = Pathname.new("#@tarball_path.incomplete")
end
@@ -227,9 +227,9 @@ end
# This strategy extracts our binary packages.
class CurlBottleDownloadStrategy < CurlDownloadStrategy
- def initialize name, package
+ def initialize name, resource
super
- @tarball_path = HOMEBREW_CACHE/"#{name}-#{package.version}#{ext}"
+ @tarball_path = HOMEBREW_CACHE/"#{name}-#{resource.version}#{ext}"
mirror = ENV['HOMEBREW_SOURCEFORGE_MIRROR']
@url = "#{@url}?use_mirror=#{mirror}" if mirror
end
@@ -244,7 +244,7 @@ class LocalBottleDownloadStrategy < CurlDownloadStrategy
end
class SubversionDownloadStrategy < AbstractDownloadStrategy
- def initialize name, package
+ def initialize name, resource
super
@@svn ||= 'svn'
@@ -347,7 +347,7 @@ class UnsafeSubversionDownloadStrategy < SubversionDownloadStrategy
end
class GitDownloadStrategy < AbstractDownloadStrategy
- def initialize name, package
+ def initialize name, resource
super
@@git ||= 'git'
@@ -502,7 +502,7 @@ class GitDownloadStrategy < AbstractDownloadStrategy
end
class CVSDownloadStrategy < AbstractDownloadStrategy
- def initialize name, package
+ def initialize name, resource
super
if name.to_s.empty? || name == '__UNKNOWN__'
@@ -558,7 +558,7 @@ class CVSDownloadStrategy < AbstractDownloadStrategy
end
class MercurialDownloadStrategy < AbstractDownloadStrategy
- def initialize name, package
+ def initialize name, resource
super
if name.to_s.empty? || name == '__UNKNOWN__'
@@ -611,7 +611,7 @@ class MercurialDownloadStrategy < AbstractDownloadStrategy
end
class BazaarDownloadStrategy < AbstractDownloadStrategy
- def initialize name, package
+ def initialize name, resource
super
if name.to_s.empty? || name == '__UNKNOWN__'
@@ -665,7 +665,7 @@ class BazaarDownloadStrategy < AbstractDownloadStrategy
end
class FossilDownloadStrategy < AbstractDownloadStrategy
- def initialize name, package
+ def initialize name, resource
super
if name.to_s.empty? || name == '__UNKNOWN__'
raise NotImplementedError, "strategy requires a name parameter"