Class: SourceMonitor::Release::Changelog
- Inherits:
-
Object
- Object
- SourceMonitor::Release::Changelog
- Defined in:
- lib/source_monitor/release/changelog.rb
Constant Summary collapse
- MissingEntryError =
Class.new(StandardError)
Instance Method Summary collapse
- #annotation_for(version) ⇒ Object
-
#initialize(path: default_path) ⇒ Changelog
constructor
A new instance of Changelog.
- #latest_entry ⇒ Object
Constructor Details
#initialize(path: default_path) ⇒ Changelog
Returns a new instance of Changelog.
10 11 12 |
# File 'lib/source_monitor/release/changelog.rb', line 10 def initialize(path: default_path) @path = Pathname.new(path) end |
Instance Method Details
#annotation_for(version) ⇒ Object
25 26 27 28 29 |
# File 'lib/source_monitor/release/changelog.rb', line 25 def annotation_for(version) raise ArgumentError, "version must be provided" if version.to_s.strip.empty? [ "SourceMonitor v#{version}", latest_entry ].join("\n\n") end |
#latest_entry ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/source_monitor/release/changelog.rb', line 14 def latest_entry @latest_entry ||= begin sections = extract_sections heading = sections.keys.find { |key| key != "## Release Checklist" } raise MissingEntryError, "Unable to find changelog entry after Release Checklist" unless heading content = ([ heading ] + sections.fetch(heading)).join content.rstrip end end |