mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Merge pull request #14065 from Bo98/cask-url-evaluate
cask/artifact/relocated: don't evaluate URL on creation
This commit is contained in:
commit
876b0dc759
@ -39,8 +39,6 @@ module Cask
|
|||||||
target
|
target
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_reader :source, :target
|
|
||||||
|
|
||||||
sig {
|
sig {
|
||||||
params(cask: Cask, source: T.nilable(T.any(String, Pathname)), target_hash: T.any(String, Pathname))
|
params(cask: Cask, source: T.nilable(T.any(String, Pathname)), target_hash: T.any(String, Pathname))
|
||||||
.void
|
.void
|
||||||
@ -51,12 +49,18 @@ module Cask
|
|||||||
target = target_hash[:target]
|
target = target_hash[:target]
|
||||||
@source_string = source.to_s
|
@source_string = source.to_s
|
||||||
@target_string = target.to_s
|
@target_string = target.to_s
|
||||||
|
end
|
||||||
|
|
||||||
|
def source
|
||||||
|
@source ||= begin
|
||||||
base_path = cask.staged_path
|
base_path = cask.staged_path
|
||||||
base_path = base_path.join(cask.url.only_path) if cask.url&.only_path.present?
|
base_path = base_path.join(cask.url.only_path) if cask.url&.only_path.present?
|
||||||
source = base_path.join(source)
|
base_path.join(@source_string)
|
||||||
@source = source
|
end
|
||||||
target ||= source.basename
|
end
|
||||||
@target = resolve_target(target)
|
|
||||||
|
def target
|
||||||
|
@target ||= resolve_target(@target_string.presence || source.basename)
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_a
|
def to_a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user