Class: Unwrappr::LockFileAnnotator
- Inherits:
-
Object
- Object
- Unwrappr::LockFileAnnotator
- Defined in:
- lib/unwrappr/lock_file_annotator.rb
Overview
The main entry object for annotating Gemfile.lock files.
This class has four main collaborators:
-
lock_file_diff_source: Provides a means of obtaining ‘LockFileDiff` instances.
-
annotation_sink: A place to send gem change annotations.
-
gem_researcher: Collects extra information about the gem change. Unwrapprs if you will.
-
annotation_writer: Collects the gem change and all the collated research and presents it in a nicely formatted annotation.
Class Method Summary collapse
-
.annotate_github_pull_request(repo:, pr_number:, lock_files:, client: Octokit.client) ⇒ Object
rubocop:disable Metrics/MethodLength.
Instance Method Summary collapse
- #annotate ⇒ Object
-
#initialize(lock_file_diff_source:, annotation_sink:, annotation_writer:, gem_researcher:) ⇒ LockFileAnnotator
constructor
rubocop:enable Metrics/MethodLength.
Constructor Details
#initialize(lock_file_diff_source:, annotation_sink:, annotation_writer:, gem_researcher:) ⇒ LockFileAnnotator
rubocop:enable Metrics/MethodLength
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/unwrappr/lock_file_annotator.rb', line 43 def initialize( lock_file_diff_source:, annotation_sink:, annotation_writer:, gem_researcher: ) @lock_file_diff_source = lock_file_diff_source @annotation_sink = annotation_sink @annotation_writer = annotation_writer @gem_researcher = gem_researcher end |
Class Method Details
.annotate_github_pull_request(repo:, pr_number:, lock_files:, client: Octokit.client) ⇒ Object
rubocop:disable Metrics/MethodLength
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/unwrappr/lock_file_annotator.rb', line 20 def self.annotate_github_pull_request( repo:, pr_number:, lock_files:, client: Octokit.client ) new( lock_file_diff_source: Github::PrSource.new(repo, pr_number, lock_files, client), annotation_sink: Github::PrSink.new(repo, pr_number, client), annotation_writer: Writers::Composite.new( Writers::Title, Writers::VersionChange, Writers::ProjectLinks, Writers::SecurityVulnerabilities, Writers::GithubCommitLog ), gem_researcher: Researchers::Composite.new( Researchers::RubyGemsInfo.new, Researchers::GithubRepo.new, Researchers::GithubComparison.new(client), Researchers::SecurityVulnerabilities.new ) ).annotate end |
Instance Method Details
#annotate ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/unwrappr/lock_file_annotator.rb', line 55 def annotate @lock_file_diff_source.each_file do |lock_file_diff| puts "Annotating #{lock_file_diff.filename}" lock_file_diff.each_gem_change do |gem_change| gem_change_info = @gem_researcher.research(gem_change, {}) = @annotation_writer.write(gem_change, gem_change_info) @annotation_sink.annotate_change(gem_change, ) end end end |