From cba55c8fd4ca128083851e6ee72814103bd2c829 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Mon, 9 Jul 2018 22:11:26 +0200 Subject: [PATCH] Add `@ref_type` and `@ref` needef for `fossil`. --- Library/Homebrew/download_strategy.rb | 2 +- Library/Homebrew/unpack_strategy.rb | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 2447777ff3..d4aa4cb1ae 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -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 diff --git a/Library/Homebrew/unpack_strategy.rb b/Library/Homebrew/unpack_strategy.rb index bc5a2d9e78..248de594c1 100644 --- a/Library/Homebrew/unpack_strategy.rb +++ b/Library/Homebrew/unpack_strategy.rb @@ -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)