Better cache names for accessory-formula
Because formula don't get named unless the brew kit instantiates them accessory formula were getting named "__UNKNOWN__". Which sucks. This isn't ideal for me as I made the naming use @name and @version to ensure unique naming. Now it is possible to have name clashes in the cache. So I need to solve it better at some point.
This commit is contained in:
parent
11c67fe0b4
commit
145e33abdf
@ -18,14 +18,18 @@
|
|||||||
class AbstractDownloadStrategy
|
class AbstractDownloadStrategy
|
||||||
def initialize url, name, version
|
def initialize url, name, version
|
||||||
@url=url
|
@url=url
|
||||||
@unique_token="#{name}-#{version}"
|
@unique_token="#{name}-#{version}" unless name.to_s.empty? or name == '__UNKNOWN__'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class HttpDownloadStrategy <AbstractDownloadStrategy
|
class HttpDownloadStrategy <AbstractDownloadStrategy
|
||||||
def fetch
|
def fetch
|
||||||
ohai "Downloading #{@url}"
|
ohai "Downloading #{@url}"
|
||||||
@dl=HOMEBREW_CACHE+(@unique_token+ext)
|
if @unique_token
|
||||||
|
@dl=HOMEBREW_CACHE+(@unique_token+ext)
|
||||||
|
else
|
||||||
|
@dl=HOMEBREW_CACHE+File.basename(@url)
|
||||||
|
end
|
||||||
unless @dl.exist?
|
unless @dl.exist?
|
||||||
curl @url, '-o', @dl
|
curl @url, '-o', @dl
|
||||||
else
|
else
|
||||||
|
|||||||
@ -254,8 +254,8 @@ private
|
|||||||
end
|
end
|
||||||
|
|
||||||
def validate_variable name
|
def validate_variable name
|
||||||
v=eval("@#{name}")
|
v=eval "@#{name}"
|
||||||
raise "Invalid @#{name}" if v.nil? or v.empty? or v =~ /\s/
|
raise "Invalid @#{name}" if v.to_s.empty? or v =~ /\s/
|
||||||
end
|
end
|
||||||
|
|
||||||
def method_added method
|
def method_added method
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user