Class: Unwrappr::Researchers::GithubComparison

Inherits:
Object
  • Object
show all
Defined in:
lib/unwrappr/researchers/github_comparison.rb

Overview

Compares the old version to the new via the Github API: developer.github.com/v3/repos/commits/#compare-two-commits

Implements the ‘gem_researcher` interface required by the LockFileAnnotator.

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ GithubComparison

Returns a new instance of GithubComparison.



11
12
13
# File 'lib/unwrappr/researchers/github_comparison.rb', line 11

def initialize(client)
  @client = client
end

Instance Method Details

#research(gem_change, change_info) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/unwrappr/researchers/github_comparison.rb', line 15

def research(gem_change, change_info)
  return change_info if github_repo_not_identified?(change_info) ||
                        gem_added_or_removed?(gem_change)

  change_info.merge(
    github_comparison: try_comparing(
      repo: github_repo(change_info),
      base: gem_change.base_version,
      head: gem_change.head_version
    )
  )
end