Download strategies take a resource now
This commit is contained in:
parent
9c7a18bdcb
commit
978f0887cb
@ -4,9 +4,9 @@ require 'utils/json'
|
|||||||
class AbstractDownloadStrategy
|
class AbstractDownloadStrategy
|
||||||
attr_accessor :local_bottle_path
|
attr_accessor :local_bottle_path
|
||||||
|
|
||||||
def initialize name, package
|
def initialize name, resource
|
||||||
@url = package.url
|
@url = resource.url
|
||||||
specs = package.specs
|
specs = resource.specs
|
||||||
@spec, @ref = specs.dup.shift unless specs.empty?
|
@spec, @ref = specs.dup.shift unless specs.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -38,16 +38,16 @@ class AbstractDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
class CurlDownloadStrategy < AbstractDownloadStrategy
|
class CurlDownloadStrategy < AbstractDownloadStrategy
|
||||||
def initialize name, package
|
def initialize name, resource
|
||||||
super
|
super
|
||||||
|
|
||||||
if name.to_s.empty? || name == '__UNKNOWN__'
|
if name.to_s.empty? || name == '__UNKNOWN__'
|
||||||
@tarball_path = Pathname.new("#{HOMEBREW_CACHE}/#{basename_without_params}")
|
@tarball_path = Pathname.new("#{HOMEBREW_CACHE}/#{basename_without_params}")
|
||||||
else
|
else
|
||||||
@tarball_path = Pathname.new("#{HOMEBREW_CACHE}/#{name}-#{package.version}#{ext}")
|
@tarball_path = Pathname.new("#{HOMEBREW_CACHE}/#{name}-#{resource.version}#{ext}")
|
||||||
end
|
end
|
||||||
|
|
||||||
@mirrors = package.mirrors
|
@mirrors = resource.mirrors
|
||||||
@temporary_path = Pathname.new("#@tarball_path.incomplete")
|
@temporary_path = Pathname.new("#@tarball_path.incomplete")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -227,9 +227,9 @@ end
|
|||||||
|
|
||||||
# This strategy extracts our binary packages.
|
# This strategy extracts our binary packages.
|
||||||
class CurlBottleDownloadStrategy < CurlDownloadStrategy
|
class CurlBottleDownloadStrategy < CurlDownloadStrategy
|
||||||
def initialize name, package
|
def initialize name, resource
|
||||||
super
|
super
|
||||||
@tarball_path = HOMEBREW_CACHE/"#{name}-#{package.version}#{ext}"
|
@tarball_path = HOMEBREW_CACHE/"#{name}-#{resource.version}#{ext}"
|
||||||
mirror = ENV['HOMEBREW_SOURCEFORGE_MIRROR']
|
mirror = ENV['HOMEBREW_SOURCEFORGE_MIRROR']
|
||||||
@url = "#{@url}?use_mirror=#{mirror}" if mirror
|
@url = "#{@url}?use_mirror=#{mirror}" if mirror
|
||||||
end
|
end
|
||||||
@ -244,7 +244,7 @@ class LocalBottleDownloadStrategy < CurlDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
class SubversionDownloadStrategy < AbstractDownloadStrategy
|
class SubversionDownloadStrategy < AbstractDownloadStrategy
|
||||||
def initialize name, package
|
def initialize name, resource
|
||||||
super
|
super
|
||||||
@@svn ||= 'svn'
|
@@svn ||= 'svn'
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ class UnsafeSubversionDownloadStrategy < SubversionDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
class GitDownloadStrategy < AbstractDownloadStrategy
|
class GitDownloadStrategy < AbstractDownloadStrategy
|
||||||
def initialize name, package
|
def initialize name, resource
|
||||||
super
|
super
|
||||||
@@git ||= 'git'
|
@@git ||= 'git'
|
||||||
|
|
||||||
@ -502,7 +502,7 @@ class GitDownloadStrategy < AbstractDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
class CVSDownloadStrategy < AbstractDownloadStrategy
|
class CVSDownloadStrategy < AbstractDownloadStrategy
|
||||||
def initialize name, package
|
def initialize name, resource
|
||||||
super
|
super
|
||||||
|
|
||||||
if name.to_s.empty? || name == '__UNKNOWN__'
|
if name.to_s.empty? || name == '__UNKNOWN__'
|
||||||
@ -558,7 +558,7 @@ class CVSDownloadStrategy < AbstractDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
class MercurialDownloadStrategy < AbstractDownloadStrategy
|
class MercurialDownloadStrategy < AbstractDownloadStrategy
|
||||||
def initialize name, package
|
def initialize name, resource
|
||||||
super
|
super
|
||||||
|
|
||||||
if name.to_s.empty? || name == '__UNKNOWN__'
|
if name.to_s.empty? || name == '__UNKNOWN__'
|
||||||
@ -611,7 +611,7 @@ class MercurialDownloadStrategy < AbstractDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
class BazaarDownloadStrategy < AbstractDownloadStrategy
|
class BazaarDownloadStrategy < AbstractDownloadStrategy
|
||||||
def initialize name, package
|
def initialize name, resource
|
||||||
super
|
super
|
||||||
|
|
||||||
if name.to_s.empty? || name == '__UNKNOWN__'
|
if name.to_s.empty? || name == '__UNKNOWN__'
|
||||||
@ -665,7 +665,7 @@ class BazaarDownloadStrategy < AbstractDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
class FossilDownloadStrategy < AbstractDownloadStrategy
|
class FossilDownloadStrategy < AbstractDownloadStrategy
|
||||||
def initialize name, package
|
def initialize name, resource
|
||||||
super
|
super
|
||||||
if name.to_s.empty? || name == '__UNKNOWN__'
|
if name.to_s.empty? || name == '__UNKNOWN__'
|
||||||
raise NotImplementedError, "strategy requires a name parameter"
|
raise NotImplementedError, "strategy requires a name parameter"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user