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