Class: Hbc::HbVCSDownloadStrategy
Constant Summary
collapse
- REF_TYPES =
[:branch, :revision, :revisions, :tag].freeze
Instance Attribute Summary
#cask, #name, #uri_object, #url, #version
Instance Method Summary
collapse
#fetch
Constructor Details
36
37
38
39
40
|
# File 'Library/Homebrew/cask/lib/hbc/download_strategy.rb', line 36
def initialize(*args, **options)
super(*args, **options)
@ref_type, @ref =
@clone = Hbc.cache.join(cache_filename)
end
|
Instance Method Details
#cache_filename ⇒ Object
49
50
51
|
# File 'Library/Homebrew/cask/lib/hbc/download_strategy.rb', line 49
def cache_filename
"#{name}--#{cache_tag}"
end
|
#cache_tag ⇒ Object
53
54
55
|
# File 'Library/Homebrew/cask/lib/hbc/download_strategy.rb', line 53
def cache_tag
"__UNKNOWN__"
end
|
#cached_location ⇒ Object
57
58
59
|
# File 'Library/Homebrew/cask/lib/hbc/download_strategy.rb', line 57
def cached_location
@clone
end
|
#clear_cache ⇒ Object
61
62
63
|
# File 'Library/Homebrew/cask/lib/hbc/download_strategy.rb', line 61
def clear_cache
cached_location.rmtree if cached_location.exist?
end
|
42
43
44
45
46
47
|
# File 'Library/Homebrew/cask/lib/hbc/download_strategy.rb', line 42
def
key = REF_TYPES.find do |type|
uri_object.respond_to?(type) && uri_object.send(type)
end
[key, key ? uri_object.send(key) : nil]
end
|