Class: Releaser::ChangeLog
- Inherits:
-
Object
- Object
- Releaser::ChangeLog
- Defined in:
- lib/releaser.rb
Instance Attribute Summary collapse
-
#commits ⇒ Object
Returns the value of attribute commits.
-
#repo ⇒ Object
Returns the value of attribute repo.
-
#tag ⇒ Object
Returns the value of attribute tag.
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(repo, tag, commits) ⇒ ChangeLog
constructor
A new instance of ChangeLog.
- #jira_prefix ⇒ Object
- #jira_url ⇒ Object
- #name ⇒ Object
- #tickets ⇒ Object
Constructor Details
#initialize(repo, tag, commits) ⇒ ChangeLog
Returns a new instance of ChangeLog.
9 10 11 |
# File 'lib/releaser.rb', line 9 def initialize(repo, tag, commits) @repo, @tag, @commits = repo, tag, commits end |
Instance Attribute Details
#commits ⇒ Object
Returns the value of attribute commits.
7 8 9 |
# File 'lib/releaser.rb', line 7 def commits @commits end |
#repo ⇒ Object
Returns the value of attribute repo.
7 8 9 |
# File 'lib/releaser.rb', line 7 def repo @repo end |
#tag ⇒ Object
Returns the value of attribute tag.
7 8 9 |
# File 'lib/releaser.rb', line 7 def tag @tag end |
Instance Method Details
#format ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/releaser.rb', line 25 def format lines = ["Release #{name}: #{tag.time}"] lines << "\nTickets Resolved:" tickets.each do |t| lines << " * #{t} - #{jira_url}/browse/#{t}" end lines << "\nCommits:" commits.each do |c| = c.[:name] = c..split("\n")[0] lines << " * [#{}] #{} (#{c.oid[0..8]})" end lines.join("\n") end |
#jira_prefix ⇒ Object
17 18 19 |
# File 'lib/releaser.rb', line 17 def jira_prefix repo.repo.config['releaser.jira.prefix'] end |
#jira_url ⇒ Object
21 22 23 |
# File 'lib/releaser.rb', line 21 def jira_url repo.repo.config['releaser.jira.url'] end |
#name ⇒ Object
13 14 15 |
# File 'lib/releaser.rb', line 13 def name tag.name end |
#tickets ⇒ Object
41 42 43 44 45 |
# File 'lib/releaser.rb', line 41 def tickets @tickets ||= Set.new(commits.flat_map { |c| c..match(/#{jira_prefix}-\d+/) { |m| m && m[0] } }.compact) end |