Class: Unwrappr::Researchers::GithubRepo
- Inherits:
-
Object
- Object
- Unwrappr::Researchers::GithubRepo
- Defined in:
- lib/unwrappr/researchers/github_repo.rb
Overview
Checks the gem metadata to obtain a Github source repository if available.
Implements the ‘gem_researcher` interface required by the LockFileAnnotator.
Constant Summary collapse
- GITHUB_URI_PATTERN =
%r{^https?:// github.com/ (?<repo>[^/]+/[[:alnum:]_.-]+) }ix.freeze
Instance Method Summary collapse
Instance Method Details
#match_repo(gem_change_info, uri_name) ⇒ Object
21 22 23 24 25 |
# File 'lib/unwrappr/researchers/github_repo.rb', line 21 def match_repo(gem_change_info, uri_name) uri = gem_change_info.dig(:ruby_gems, uri_name) match = GITHUB_URI_PATTERN.match(uri) match[:repo] if match end |
#research(_gem_change, gem_change_info) ⇒ Object
15 16 17 18 19 |
# File 'lib/unwrappr/researchers/github_repo.rb', line 15 def research(_gem_change, gem_change_info) repo = match_repo(gem_change_info, 'source_code_uri') || match_repo(gem_change_info, 'homepage_uri') gem_change_info.merge(github_repo: repo) end |