Sha256: 668e96826f721475b69d32e76d38f0c2413ca53559ff15b9385f7e3c471cee16
Contents?: true
Size: 1.4 KB
Versions: 1
Compression:
Stored size: 1.4 KB
Contents
require 'structured_changelog/core_ext/string' require 'structured_changelog/core_ext/gem' class StructuredChangelog class ReleasePreview def initialize(changelog:, repo:) @changelog = changelog @repo = repo end def to_s "## RELEASE #{new_version}\n\n#{release_notes}" end def empty? release_notes.empty? end private attr_reader :changelog, :repo def release_notes @release_notes ||= repo.log.between("v#{current_version}"). map(&:message). flat_map { |message| message.split("\n") }. grep(/^\*\ (BREAKING|FEATURE|ENHANCEMENT|FIX|DEPRECATION)\:/). map(&:strip). join("\n") end def current_version @current_version ||= changelog.version end def new_version @new_version ||= if release_notes.match?(/^*\ BREAKING:/) current_version.bump_major elsif release_notes.match?(/^*\ FEATURE:/) current_version.bump_minor elsif release_notes.match?(/^*\ FIX:/) current_version.bump_patch elsif release_notes.match?(/^*\ ENHANCEMENT:/) current_version.bump_patch elsif release_notes.match?(/^*\ DEPRECATION:/) current_version.bump_patch end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
structured_changelog-0.11.0 | lib/structured_changelog/release_preview.rb |