Remove dead code
Formula objects are always constructed with an explicit name, so we no longer need to special case an empty name or the name "__UNKNOWN__".
This commit is contained in:
parent
33eed80ccc
commit
197dbe5601
@ -1,5 +1,4 @@
|
|||||||
require 'utils/json'
|
require 'utils/json'
|
||||||
require 'erb'
|
|
||||||
|
|
||||||
class AbstractDownloadStrategy
|
class AbstractDownloadStrategy
|
||||||
attr_reader :name, :resource
|
attr_reader :name, :resource
|
||||||
@ -53,12 +52,8 @@ class VCSDownloadStrategy < AbstractDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def cache_filename(tag=cache_tag)
|
def cache_filename(tag=cache_tag)
|
||||||
if name.empty? || name == '__UNKNOWN__'
|
|
||||||
"#{ERB::Util.url_encode(@url)}--#{tag}"
|
|
||||||
else
|
|
||||||
"#{name}--#{tag}"
|
"#{name}--#{tag}"
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def cache_tag
|
def cache_tag
|
||||||
"__UNKNOWN__"
|
"__UNKNOWN__"
|
||||||
@ -79,11 +74,7 @@ class CurlDownloadStrategy < AbstractDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def tarball_path
|
def tarball_path
|
||||||
@tarball_path ||= if name.empty? || name == '__UNKNOWN__'
|
@tarball_path ||= Pathname.new("#{HOMEBREW_CACHE}/#{name}-#{resource.version}#{ext}")
|
||||||
Pathname.new("#{HOMEBREW_CACHE}/#{basename_without_params}")
|
|
||||||
else
|
|
||||||
Pathname.new("#{HOMEBREW_CACHE}/#{name}-#{resource.version}#{ext}")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def temporary_path
|
def temporary_path
|
||||||
|
|||||||
@ -50,16 +50,6 @@ class VCSDownloadStrategyTests < Homebrew::TestCase
|
|||||||
downloader = @strategy.new("baz", @resource)
|
downloader = @strategy.new("baz", @resource)
|
||||||
assert_equal "baz--foo", downloader.cache_filename("foo")
|
assert_equal "baz--foo", downloader.cache_filename("foo")
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_empty_name
|
|
||||||
downloader = @strategy.new("", @resource)
|
|
||||||
assert_equal escaped("foo"), downloader.cache_filename("foo")
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_unknown_name
|
|
||||||
downloader = @strategy.new("__UNKNOWN__", @resource)
|
|
||||||
assert_equal escaped("foo"), downloader.cache_filename("foo")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class DownloadStrategyDetectorTests < Homebrew::TestCase
|
class DownloadStrategyDetectorTests < Homebrew::TestCase
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user