lib/compare_linker.rb in compare_linker-1.4.2 vs lib/compare_linker.rb in compare_linker-1.4.3
- old
+ new
@@ -24,40 +24,44 @@
fetcher = LockfileFetcher.new(requested_repository_octokit)
old_lockfile = fetcher.fetch(repo_full_name, pull_request.base.sha)
new_lockfile = fetcher.fetch(repo_full_name, pull_request.head.sha)
- comparator = LockfileComparator.new
- comparator.compare(old_lockfile, new_lockfile)
- @compare_links = comparator.updated_gems.map { |gem_name, gem_info|
- if gem_info[:owner].nil?
- finder = GithubLinkFinder.new(octokit, gem_dictionary)
- finder.find(gem_name)
- gem_info[:homepage_uri] = finder.homepage_uri
- if finder.repo_owner.nil?
- formatter.format(gem_info)
- else
- gem_info[:repo_owner] = finder.repo_owner
- gem_info[:repo_name] = finder.repo_name
+ make_compare_links_from_lockfiles(old_lockfile, new_lockfile)
+ end
+ end
- tag_finder = GithubTagFinder.new(octokit, gem_name, finder.repo_full_name)
- old_tag = tag_finder.find(gem_info[:old_ver])
- new_tag = tag_finder.find(gem_info[:new_ver])
+ def make_compare_links_from_lockfiles(old_lockfile, new_lockfile)
+ comparator = LockfileComparator.new
+ comparator.compare(old_lockfile, new_lockfile)
+ @compare_links = comparator.updated_gems.map { |gem_name, gem_info|
+ if gem_info[:owner].nil?
+ finder = GithubLinkFinder.new(octokit, gem_dictionary)
+ finder.find(gem_name)
+ gem_info[:homepage_uri] = finder.homepage_uri
+ if finder.repo_owner.nil?
+ formatter.format(gem_info)
+ else
+ gem_info[:repo_owner] = finder.repo_owner
+ gem_info[:repo_name] = finder.repo_name
- if old_tag && new_tag
- gem_info[:old_tag] = old_tag.name
- gem_info[:new_tag] = new_tag.name
- formatter.format(gem_info)
- else
- formatter.format(gem_info)
- end
+ tag_finder = GithubTagFinder.new(octokit, gem_name, finder.repo_full_name)
+ old_tag = tag_finder.find(gem_info[:old_ver])
+ new_tag = tag_finder.find(gem_info[:new_ver])
+
+ if old_tag && new_tag
+ gem_info[:old_tag] = old_tag.name
+ gem_info[:new_tag] = new_tag.name
+ formatter.format(gem_info)
+ else
+ formatter.format(gem_info)
end
- else
- formatter.format(gem_info)
end
- }
- @compare_links
- end
+ else
+ formatter.format(gem_info)
+ end
+ }
+ @compare_links
end
def add_comment(repo_full_name, pr_number, compare_links)
res = requested_repository_octokit.add_comment(
repo_full_name,