Remove more dead code

This commit is contained in:
Jack Nagel 2014-07-16 23:19:58 -05:00
parent 28f0e5c4fd
commit 4295e76d3f
2 changed files with 9 additions and 16 deletions

View File

@ -43,7 +43,7 @@ class VCSDownloadStrategy < AbstractDownloadStrategy
def initialize name, resource def initialize name, resource
super super
@ref_type, @ref = extract_ref(resource.specs) @ref_type, @ref = extract_ref(resource.specs)
@clone = HOMEBREW_CACHE/cache_filename @clone = HOMEBREW_CACHE.join(cache_filename)
end end
def extract_ref(specs) def extract_ref(specs)
@ -51,8 +51,8 @@ class VCSDownloadStrategy < AbstractDownloadStrategy
return key, specs[key] return key, specs[key]
end end
def cache_filename(tag=cache_tag) def cache_filename
"#{name}--#{tag}" "#{name}--#{cache_tag}"
end end
def cache_tag def cache_tag
@ -634,7 +634,7 @@ class CVSDownloadStrategy < VCSDownloadStrategy
unless @clone.exist? unless @clone.exist?
HOMEBREW_CACHE.cd do HOMEBREW_CACHE.cd do
safe_system cvspath, '-d', url, 'login' safe_system cvspath, '-d', url, 'login'
safe_system cvspath, '-d', url, 'checkout', '-d', cache_filename("cvs"), mod safe_system cvspath, '-d', url, 'checkout', '-d', cache_filename, mod
end end
else else
puts "Updating #{@clone}" puts "Updating #{@clone}"

View File

@ -37,18 +37,11 @@ class AbstractDownloadStrategyTests < Homebrew::TestCase
end end
class VCSDownloadStrategyTests < Homebrew::TestCase class VCSDownloadStrategyTests < Homebrew::TestCase
def setup def test_cache_filename
@resource = ResourceDouble.new("http://example.com/bar") resource = ResourceDouble.new("http://example.com/bar")
@strategy = VCSDownloadStrategy strategy = Class.new(VCSDownloadStrategy) { def cache_tag; "foo"; end }
end downloader = strategy.new("baz", resource)
assert_equal "baz--foo", downloader.cache_filename
def escaped(tag)
"#{ERB::Util.url_encode(@resource.url)}--#{tag}"
end
def test_explicit_name
downloader = @strategy.new("baz", @resource)
assert_equal "baz--foo", downloader.cache_filename("foo")
end end
end end