Class: CompareLinker::LockfileFetcher
- Inherits:
-
Object
- Object
- CompareLinker::LockfileFetcher
- Defined in:
- lib/compare_linker/lockfile_fetcher.rb
Instance Attribute Summary collapse
-
#octokit ⇒ Object
readonly
Returns the value of attribute octokit.
Instance Method Summary collapse
- #fetch(repo_full_name, ref) ⇒ Object
-
#initialize(octokit) ⇒ LockfileFetcher
constructor
A new instance of LockfileFetcher.
Constructor Details
#initialize(octokit) ⇒ LockfileFetcher
Returns a new instance of LockfileFetcher.
8 9 10 |
# File 'lib/compare_linker/lockfile_fetcher.rb', line 8 def initialize(octokit) @octokit = octokit end |
Instance Attribute Details
#octokit ⇒ Object (readonly)
Returns the value of attribute octokit.
6 7 8 |
# File 'lib/compare_linker/lockfile_fetcher.rb', line 6 def octokit @octokit end |
Instance Method Details
#fetch(repo_full_name, ref) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/compare_linker/lockfile_fetcher.rb', line 12 def fetch(repo_full_name, ref) lockfile_content = octokit.contents( repo_full_name, { ref: ref } ).find { |content| content.name == "Gemfile.lock" } Bundler::LockfileParser.new( Base64.decode64( octokit.blob(repo_full_name, lockfile_content.sha).content ) ) end |