Use -- to separate download name and version.
This commit is contained in:
parent
76243269c0
commit
1003d722bd
@ -1,6 +1,7 @@
|
||||
require "compat/os/mac"
|
||||
require "compat/dependable"
|
||||
require "compat/dependency_collector"
|
||||
require "compat/download_strategy"
|
||||
require "compat/fileutils"
|
||||
require "compat/formula_support"
|
||||
require "compat/hbc"
|
||||
|
||||
16
Library/Homebrew/compat/download_strategy.rb
Normal file
16
Library/Homebrew/compat/download_strategy.rb
Normal file
@ -0,0 +1,16 @@
|
||||
class AbstractFileDownloadStrategy
|
||||
# TODO: This can be removed after a month because downloads
|
||||
# will be outdated anyways at that point.
|
||||
module Compat
|
||||
def initialize(url, name, version, **meta)
|
||||
super
|
||||
|
||||
old_cached_location = @cache/"#{name}-#{version}#{ext}"
|
||||
|
||||
return unless old_cached_location.exist?
|
||||
FileUtils.mv old_cached_location, cached_location, force: true
|
||||
end
|
||||
end
|
||||
|
||||
prepend Compat
|
||||
end
|
||||
@ -181,7 +181,7 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy
|
||||
|
||||
def initialize(url, name, version, **meta)
|
||||
super
|
||||
@cached_location = @cache/"#{name}-#{version}#{ext}"
|
||||
@cached_location = @cache/"#{name}--#{version}#{ext}"
|
||||
@temporary_path = Pathname.new("#{cached_location}.incomplete")
|
||||
end
|
||||
|
||||
|
||||
@ -2,10 +2,10 @@ describe "brew fetch", :integration_test do
|
||||
it "downloads the Formula's URL" do
|
||||
setup_test_formula "testball"
|
||||
|
||||
expect(HOMEBREW_CACHE/"testball-0.1.tbz").not_to exist
|
||||
expect(HOMEBREW_CACHE/"testball--0.1.tbz").not_to exist
|
||||
|
||||
expect { brew "fetch", "testball" }.to be_a_success
|
||||
|
||||
expect(HOMEBREW_CACHE/"testball-0.1.tbz").to exist
|
||||
expect(HOMEBREW_CACHE/"testball--0.1.tbz").to exist
|
||||
end
|
||||
end
|
||||
|
||||
@ -238,13 +238,13 @@ describe CurlDownloadStrategy do
|
||||
subject { described_class.new(url, name, version, **specs).cached_location }
|
||||
|
||||
context "when URL ends with file" do
|
||||
it { is_expected.to eq(HOMEBREW_CACHE/"foo-.tar.gz") }
|
||||
it { is_expected.to eq(HOMEBREW_CACHE/"foo--.tar.gz") }
|
||||
end
|
||||
|
||||
context "when URL file is in middle" do
|
||||
let(:url) { "http://example.com/foo.tar.gz/from/this/mirror" }
|
||||
|
||||
it { is_expected.to eq(HOMEBREW_CACHE/"foo-.tar.gz") }
|
||||
it { is_expected.to eq(HOMEBREW_CACHE/"foo--.tar.gz") }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user