VCSDownloadStrategy: use REF_TYPES when extracting ref to use
This commit is contained in:
parent
41e3b2cad0
commit
5ce4c2a3f8
@ -43,12 +43,13 @@ class VCSDownloadStrategy < AbstractDownloadStrategy
|
|||||||
|
|
||||||
def initialize name, resource
|
def initialize name, resource
|
||||||
super
|
super
|
||||||
@ref_type, @ref = destructure_spec_hash(resource.specs)
|
@ref_type, @ref = extract_ref(resource.specs)
|
||||||
@clone = HOMEBREW_CACHE/cache_filename
|
@clone = HOMEBREW_CACHE/cache_filename
|
||||||
end
|
end
|
||||||
|
|
||||||
def destructure_spec_hash(spec)
|
def extract_ref(specs)
|
||||||
spec.each { |o| return o }
|
key = REF_TYPES.find { |type| specs.key?(type) }
|
||||||
|
return key, specs[key]
|
||||||
end
|
end
|
||||||
|
|
||||||
def cache_filename(tag=cache_tag)
|
def cache_filename(tag=cache_tag)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user