Add @ref_type and @ref needef for fossil.

This commit is contained in:
Markus Reiter 2018-07-09 22:11:26 +02:00
parent 5dfa4ded43
commit cba55c8fd4
2 changed files with 6 additions and 4 deletions

View File

@ -47,7 +47,7 @@ class AbstractDownloadStrategy
# chdir into the newly-unpacked directory.
# Unlike {Resource#stage}, this does not take a block.
def stage
UnpackStrategy.detect(cached_location)
UnpackStrategy.detect(cached_location, ref_type: @ref_type, ref: @ref)
.extract(basename: basename_without_params)
end

View File

@ -27,7 +27,7 @@ class UnpackStrategy
end
private_class_method :strategies
def self.detect(path)
def self.detect(path, ref_type: nil, ref: nil)
magic_number = if path.directory?
""
else
@ -48,13 +48,15 @@ class UnpackStrategy
UncompressedUnpackStrategy
end
strategy.new(path)
strategy.new(path, ref_type: ref_type, ref: ref)
end
attr_reader :path
def initialize(path)
def initialize(path, ref_type: nil, ref: nil)
@path = Pathname(path).expand_path
@ref_type = ref_type
@ref = ref
end
def extract(to: nil, basename: nil)