mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
resource: escape slashes from download_name
This is useful to be able to write go resources using their package name as the resource name
This commit is contained in:
parent
356c391dfb
commit
aec47d8a19
@ -31,8 +31,15 @@ class Resource
|
||||
@downloader ||= download_strategy.new(download_name, self)
|
||||
end
|
||||
|
||||
# Removes /s from resource names; this allows go package names
|
||||
# to be used as resource names without confusing software that
|
||||
# interacts with download_name, e.g. github.com/foo/bar
|
||||
def escaped_name
|
||||
name.gsub("/", '-')
|
||||
end
|
||||
|
||||
def download_name
|
||||
name.nil? ? owner.name : "#{owner.name}--#{name}"
|
||||
name.nil? ? owner.name : "#{owner.name}--#{escaped_name}"
|
||||
end
|
||||
|
||||
def cached_download
|
||||
|
Loading…
x
Reference in New Issue
Block a user