VCSDownloadStrategy: rename checkout_name to cache_filename

This commit is contained in:
Jack Nagel 2013-10-11 00:11:58 -05:00
parent dd719e7ca6
commit ed7f8faed2
2 changed files with 13 additions and 13 deletions

View File

@ -48,7 +48,7 @@ class VCSDownloadStrategy < AbstractDownloadStrategy
spec.each { |o| return o }
end
def checkout_name(tag)
def cache_filename(tag)
if name.empty? || name == '__UNKNOWN__'
"#{ERB::Util.url_encode(@url)}--#{tag}"
else
@ -321,9 +321,9 @@ class SubversionDownloadStrategy < VCSDownloadStrategy
@@svn ||= 'svn'
if ARGV.build_head?
@clone = Pathname.new("#{HOMEBREW_CACHE}/#{checkout_name("svn-HEAD")}")
@clone = Pathname.new("#{HOMEBREW_CACHE}/#{cache_filename("svn-HEAD")}")
else
@clone = Pathname.new("#{HOMEBREW_CACHE}/#{checkout_name("svn")}")
@clone = Pathname.new("#{HOMEBREW_CACHE}/#{cache_filename("svn")}")
end
end
@ -427,7 +427,7 @@ class GitDownloadStrategy < VCSDownloadStrategy
def initialize name, resource
super
@@git ||= 'git'
@clone = Pathname.new("#{HOMEBREW_CACHE}/#{checkout_name("git")}")
@clone = Pathname.new("#{HOMEBREW_CACHE}/#{cache_filename("git")}")
end
def fetch
@ -570,7 +570,7 @@ end
class CVSDownloadStrategy < VCSDownloadStrategy
def initialize name, resource
super
@clone = Pathname.new("#{HOMEBREW_CACHE}/#{checkout_name("cvs")}")
@clone = Pathname.new("#{HOMEBREW_CACHE}/#{cache_filename("cvs")}")
end
def fetch
@ -585,7 +585,7 @@ class CVSDownloadStrategy < VCSDownloadStrategy
unless @clone.exist?
HOMEBREW_CACHE.cd do
safe_system '/usr/bin/cvs', '-d', url, 'login'
safe_system '/usr/bin/cvs', '-d', url, 'checkout', '-d', checkout_name("cvs"), mod
safe_system '/usr/bin/cvs', '-d', url, 'checkout', '-d', cache_filename("cvs"), mod
end
else
puts "Updating #{@clone}"
@ -618,7 +618,7 @@ end
class MercurialDownloadStrategy < VCSDownloadStrategy
def initialize name, resource
super
@clone = Pathname.new("#{HOMEBREW_CACHE}/#{checkout_name("hg")}")
@clone = Pathname.new("#{HOMEBREW_CACHE}/#{cache_filename("hg")}")
end
def hgpath
@ -671,7 +671,7 @@ end
class BazaarDownloadStrategy < VCSDownloadStrategy
def initialize name, resource
super
@clone = Pathname.new("#{HOMEBREW_CACHE}/#{checkout_name("bzr")}")
@clone = Pathname.new("#{HOMEBREW_CACHE}/#{cache_filename("bzr")}")
end
def bzrpath
@ -717,7 +717,7 @@ end
class FossilDownloadStrategy < VCSDownloadStrategy
def initialize name, resource
super
@clone = Pathname.new("#{HOMEBREW_CACHE}/#{checkout_name("fossil")}")
@clone = Pathname.new("#{HOMEBREW_CACHE}/#{cache_filename("fossil")}")
end
def fossilpath

View File

@ -37,7 +37,7 @@ class AbstractDownloadStrategyTests < Test::Unit::TestCase
end
end
class DownloadStrategyCheckoutNameTests < Test::Unit::TestCase
class VCSDownloadStrategyTests < Test::Unit::TestCase
def setup
@resource = ResourceDouble.new("http://foo.com/bar")
@strategy = VCSDownloadStrategy
@ -49,17 +49,17 @@ class DownloadStrategyCheckoutNameTests < Test::Unit::TestCase
def test_explicit_name
downloader = @strategy.new("baz", @resource)
assert_equal "baz--foo", downloader.checkout_name("foo")
assert_equal "baz--foo", downloader.cache_filename("foo")
end
def test_empty_name
downloader = @strategy.new("", @resource)
assert_equal escaped("foo"), downloader.checkout_name("foo")
assert_equal escaped("foo"), downloader.cache_filename("foo")
end
def test_unknown_name
downloader = @strategy.new("__UNKNOWN__", @resource)
assert_equal escaped("foo"), downloader.checkout_name("foo")
assert_equal escaped("foo"), downloader.cache_filename("foo")
end
end