Class: Unwrappr::Writers::GithubCommitLog

Inherits:
Object
  • Object
show all
Defined in:
lib/unwrappr/writers/github_commit_log.rb

Overview

Inform of the number of commits included in the change. Annotate several commits, and link to the Github compare page on which we can see all the commits and file changes.

Implements the ‘annotation_writer` interface required by the LockFileAnnotator.

Constant Summary collapse

MAX_COMMITS =
10
MAX_MESSAGE =
60
SHA_LENGTH =
7

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gem_change, gem_change_info) ⇒ GithubCommitLog

Returns a new instance of GithubCommitLog.



20
21
22
23
# File 'lib/unwrappr/writers/github_commit_log.rb', line 20

def initialize(gem_change, gem_change_info)
  @gem_change = gem_change
  @gem_change_info = gem_change_info
end

Class Method Details

.write(gem_change, gem_change_info) ⇒ Object



16
17
18
# File 'lib/unwrappr/writers/github_commit_log.rb', line 16

def self.write(gem_change, gem_change_info)
  new(gem_change, gem_change_info).write
end

Instance Method Details

#writeObject



25
26
27
28
29
30
31
32
33
34
# File 'lib/unwrappr/writers/github_commit_log.rb', line 25

def write
  return nil if comparison.nil?

  collapsed_section('Commits', "    A change of **\#{comparison.total_commits}** commits. See the full changes on [the compare page](\#{comparison.html_url}).\n\n    \#{list_commits_introduction}\n    \#{commit_messages.join(\"\\n\")}\n  MESSAGE\nend\n")