mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Fix inheritance style in download strats.
This commit is contained in:
parent
8c7ac47c85
commit
7c4289d446
@ -28,7 +28,7 @@ class AbstractDownloadStrategy
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class CurlDownloadStrategy <AbstractDownloadStrategy
|
class CurlDownloadStrategy < AbstractDownloadStrategy
|
||||||
attr_reader :tarball_path
|
attr_reader :tarball_path
|
||||||
|
|
||||||
def initialize url, name, version, specs
|
def initialize url, name, version, specs
|
||||||
@ -128,7 +128,7 @@ end
|
|||||||
|
|
||||||
# Download via an HTTP POST.
|
# Download via an HTTP POST.
|
||||||
# Query parameters on the URL are converted into POST parameters
|
# Query parameters on the URL are converted into POST parameters
|
||||||
class CurlPostDownloadStrategy <CurlDownloadStrategy
|
class CurlPostDownloadStrategy < CurlDownloadStrategy
|
||||||
def _fetch
|
def _fetch
|
||||||
base_url,data = @url.split('?')
|
base_url,data = @url.split('?')
|
||||||
curl base_url, '-d', data, '-o', @tarball_path
|
curl base_url, '-d', data, '-o', @tarball_path
|
||||||
@ -137,7 +137,7 @@ end
|
|||||||
|
|
||||||
# Use this strategy to download but not unzip a file.
|
# Use this strategy to download but not unzip a file.
|
||||||
# Useful for installing jars.
|
# Useful for installing jars.
|
||||||
class NoUnzipCurlDownloadStrategy <CurlDownloadStrategy
|
class NoUnzipCurlDownloadStrategy < CurlDownloadStrategy
|
||||||
def stage
|
def stage
|
||||||
FileUtils.cp @tarball_path, File.basename(@url)
|
FileUtils.cp @tarball_path, File.basename(@url)
|
||||||
end
|
end
|
||||||
@ -146,7 +146,7 @@ end
|
|||||||
# This Download Strategy is provided for use with sites that
|
# This Download Strategy is provided for use with sites that
|
||||||
# only provide HTTPS and also have a broken cert.
|
# only provide HTTPS and also have a broken cert.
|
||||||
# Try not to need this, as we probably won't accept the formula.
|
# Try not to need this, as we probably won't accept the formula.
|
||||||
class CurlUnsafeDownloadStrategy <CurlDownloadStrategy
|
class CurlUnsafeDownloadStrategy < CurlDownloadStrategy
|
||||||
def _fetch
|
def _fetch
|
||||||
curl @url, '--insecure', '-o', @tarball_path
|
curl @url, '--insecure', '-o', @tarball_path
|
||||||
end
|
end
|
||||||
@ -223,7 +223,7 @@ class SubversionDownloadStrategy <AbstractDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Require a newer version of Subversion than 1.4.x (Leopard-provided version)
|
# Require a newer version of Subversion than 1.4.x (Leopard-provided version)
|
||||||
class StrictSubversionDownloadStrategy <SubversionDownloadStrategy
|
class StrictSubversionDownloadStrategy < SubversionDownloadStrategy
|
||||||
def svn
|
def svn
|
||||||
exe = super
|
exe = super
|
||||||
`#{exe} --version` =~ /version (\d+\.\d+(\.\d+)*)/
|
`#{exe} --version` =~ /version (\d+\.\d+(\.\d+)*)/
|
||||||
@ -240,7 +240,7 @@ class StrictSubversionDownloadStrategy <SubversionDownloadStrategy
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class GitDownloadStrategy <AbstractDownloadStrategy
|
class GitDownloadStrategy < AbstractDownloadStrategy
|
||||||
def initialize url, name, version, specs
|
def initialize url, name, version, specs
|
||||||
super
|
super
|
||||||
@unique_token="#{name}--git" unless name.to_s.empty? or name == '__UNKNOWN__'
|
@unique_token="#{name}--git" unless name.to_s.empty? or name == '__UNKNOWN__'
|
||||||
@ -313,7 +313,7 @@ class GitDownloadStrategy <AbstractDownloadStrategy
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class CVSDownloadStrategy <AbstractDownloadStrategy
|
class CVSDownloadStrategy < AbstractDownloadStrategy
|
||||||
def initialize url, name, version, specs
|
def initialize url, name, version, specs
|
||||||
super
|
super
|
||||||
@unique_token="#{name}--cvs" unless name.to_s.empty? or name == '__UNKNOWN__'
|
@unique_token="#{name}--cvs" unless name.to_s.empty? or name == '__UNKNOWN__'
|
||||||
@ -363,7 +363,7 @@ private
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class MercurialDownloadStrategy <AbstractDownloadStrategy
|
class MercurialDownloadStrategy < AbstractDownloadStrategy
|
||||||
def initialize url, name, version, specs
|
def initialize url, name, version, specs
|
||||||
super
|
super
|
||||||
@unique_token="#{name}--hg" unless name.to_s.empty? or name == '__UNKNOWN__'
|
@unique_token="#{name}--hg" unless name.to_s.empty? or name == '__UNKNOWN__'
|
||||||
@ -404,7 +404,7 @@ class MercurialDownloadStrategy <AbstractDownloadStrategy
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class BazaarDownloadStrategy <AbstractDownloadStrategy
|
class BazaarDownloadStrategy < AbstractDownloadStrategy
|
||||||
def initialize url, name, version, specs
|
def initialize url, name, version, specs
|
||||||
super
|
super
|
||||||
@unique_token="#{name}--bzr" unless name.to_s.empty? or name == '__UNKNOWN__'
|
@unique_token="#{name}--bzr" unless name.to_s.empty? or name == '__UNKNOWN__'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user