Class: ReleaseCeremony::Changelog
- Inherits:
-
Object
- Object
- ReleaseCeremony::Changelog
- Defined in:
- lib/release_ceremony/changelog.rb
Overview
Transforms a Keep a Changelog file for a release: the Unreleased notes move under a new dated heading and the comparison links are rewritten.
Constant Summary collapse
- UNRELEASED_HEADING =
/^## \[Unreleased\][ \t]*$/- VERSION_HEADING =
/^## \[[^\]]+\].*$/- REFERENCE_DEFINITION =
/^\[[^\]]+\]:[ \t]+.*$/- ANY_UNRELEASED_LINK =
/^\[Unreleased\]:.*$/
Instance Method Summary collapse
-
#initialize(contents:, current_version:, version:, today:, compare_base:, changelog_file:) ⇒ Changelog
constructor
A new instance of Changelog.
- #transform ⇒ Object
Constructor Details
#initialize(contents:, current_version:, version:, today:, compare_base:, changelog_file:) ⇒ Changelog
Returns a new instance of Changelog.
12 13 14 15 16 17 18 19 |
# File 'lib/release_ceremony/changelog.rb', line 12 def initialize(contents:, current_version:, version:, today:, compare_base:, changelog_file:) @contents = contents @current_version = current_version @version = version @today = today @compare_base = compare_base @changelog_file = changelog_file end |
Instance Method Details
#transform ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/release_ceremony/changelog.rb', line 21 def transform heading = unreleased_heading ensure_unreleased_notes!(heading) ensure_requested_version_absent! link = unreleased_link ensure_previous_version_matches!(link) insert_release_heading(heading).sub(link[0], replacement_links) end |