Class: Mmi::Source::Github
Instance Method Summary
collapse
#[], #initialize, #parse!, #parsed_property_store, prepended, #to_h, #update_properties!, #validate_constraints!
Instance Method Details
#cached_asset_response ⇒ Object
27
28
29
|
# File 'lib/mmi/source/github.rb', line 27
def cached_asset_response
@cached_asset_response ||= Mmi::GithubApi.client.release_asset("/repos/#{self.owner}/#{self.repo}/releases/assets/#{self.asset_id}")
end
|
#display_name ⇒ Object
45
46
47
|
# File 'lib/mmi/source/github.rb', line 45
def display_name
repository_url
end
|
#download_url ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/mmi/source/github.rb', line 31
def download_url
if self.asset_id
cached_asset_response.browser_download_url
else
"#{repository_url}/releases/download/#{release}/#{file}"
end
end
|
#install(install_record) ⇒ Object
39
40
41
42
43
|
# File 'lib/mmi/source/github.rb', line 39
def install(install_record)
filepath = File.join(install_dir, self.filename || (self.asset_id ? cached_asset_response.name : self.file))
install_record.add(download_url, filepath, content_hash: nil) end
|
#repository_url ⇒ Object
TODO: Ensure that either :asset_id or [:release, :file] is given.
23
24
25
|
# File 'lib/mmi/source/github.rb', line 23
def repository_url
"https://github.com/#{self.owner}/#{self.repo}"
end
|