Merge pull request #4598 from reitermarkus/temporary_path
Move `temporary_path` to `AbstractFileDownloadStrategy`.
This commit is contained in:
commit
74cace5b36
@ -176,9 +176,12 @@ class VCSDownloadStrategy < AbstractDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
class AbstractFileDownloadStrategy < AbstractDownloadStrategy
|
class AbstractFileDownloadStrategy < AbstractDownloadStrategy
|
||||||
|
attr_reader :temporary_path
|
||||||
|
|
||||||
def initialize(url, name, version, **meta)
|
def initialize(url, name, version, **meta)
|
||||||
super
|
super
|
||||||
@cached_location = HOMEBREW_CACHE/"#{name}-#{version}#{ext}"
|
@cached_location = HOMEBREW_CACHE/"#{name}-#{version}#{ext}"
|
||||||
|
@temporary_path = Pathname.new("#{cached_location}.incomplete")
|
||||||
end
|
end
|
||||||
|
|
||||||
def stage
|
def stage
|
||||||
@ -203,12 +206,11 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
||||||
attr_reader :mirrors, :temporary_path
|
attr_reader :mirrors
|
||||||
|
|
||||||
def initialize(url, name, version, **meta)
|
def initialize(url, name, version, **meta)
|
||||||
super
|
super
|
||||||
@mirrors = meta.fetch(:mirrors, [])
|
@mirrors = meta.fetch(:mirrors, [])
|
||||||
@temporary_path = Pathname.new("#{cached_location}.incomplete")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch
|
def fetch
|
||||||
@ -507,12 +509,8 @@ end
|
|||||||
# url "scp://example.com/src/abc.1.0.tar.gz"
|
# url "scp://example.com/src/abc.1.0.tar.gz"
|
||||||
# ...
|
# ...
|
||||||
class ScpDownloadStrategy < AbstractFileDownloadStrategy
|
class ScpDownloadStrategy < AbstractFileDownloadStrategy
|
||||||
attr_reader :temporary_path
|
|
||||||
|
|
||||||
def initialize(url, name, version, **meta)
|
def initialize(url, name, version, **meta)
|
||||||
super
|
super
|
||||||
@cached_location = HOMEBREW_CACHE/"#{name}-#{version}#{ext}"
|
|
||||||
@temporary_path = Pathname.new("#{cached_location}.incomplete")
|
|
||||||
parse_url_pattern
|
parse_url_pattern
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user