mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Document download strategy interface
This commit is contained in:
parent
5575fb843c
commit
957ef9b6b9
@ -13,6 +13,23 @@ class AbstractDownloadStrategy
|
|||||||
@meta = resource.specs
|
@meta = resource.specs
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Download and cache the resource as {#cached_location}.
|
||||||
|
def fetch
|
||||||
|
end
|
||||||
|
|
||||||
|
# Unpack {#cached_location} into the current working directory.
|
||||||
|
def stage
|
||||||
|
end
|
||||||
|
|
||||||
|
# The path to the cached file or directory associated with the resource.
|
||||||
|
def cached_location
|
||||||
|
end
|
||||||
|
|
||||||
|
# Remove {#cached_location} and any other files associated with the resource
|
||||||
|
# from the cache.
|
||||||
|
def clear_cache
|
||||||
|
end
|
||||||
|
|
||||||
def expand_safe_system_args args
|
def expand_safe_system_args args
|
||||||
args = args.dup
|
args = args.dup
|
||||||
args.each_with_index do |arg, ii|
|
args.each_with_index do |arg, ii|
|
||||||
@ -34,12 +51,6 @@ class AbstractDownloadStrategy
|
|||||||
safe_system(*expand_safe_system_args(args))
|
safe_system(*expand_safe_system_args(args))
|
||||||
end
|
end
|
||||||
|
|
||||||
# All download strategies are expected to implement these methods
|
|
||||||
def fetch; end
|
|
||||||
def stage; end
|
|
||||||
def cached_location; end
|
|
||||||
def clear_cache; end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def xzpath
|
def xzpath
|
||||||
|
Loading…
x
Reference in New Issue
Block a user