Sha256: 47e9cd569b602bf21fd9c8fbc96bf110c55698f74846b8c4a54f156a154b1aa6
Contents?: true
Size: 896 Bytes
Versions: 3
Compression:
Stored size: 896 Bytes
Contents
require 'git' require 'structured_changelog' require 'structured_changelog/release_preview' desc "Pull all release lines from git commits since the last release and insert them into a release section in the changelog" task "changelog:compile", [:repo_path, :changelog_path] do |_task, arguments| repo_path = arguments.to_h.fetch(:repo_path) { Pathname.pwd } changelog_path = arguments.to_h.fetch(:changelog_path) { Pathname.pwd/"CHANGELOG.md" } changelog = StructuredChangelog.new(changelog_path) release_preview = StructuredChangelog::ReleasePreview.new( changelog: changelog, repo: Git.open(repo_path), ) abort("No release notes since the last release") if release_preview.empty? changelog_path.write( changelog_path.read.sub( /^##\ RELEASE\ #{changelog.version}/, "#{release_preview}\n\n## RELEASE #{changelog.version}" ) ) end
Version data entries
3 entries across 3 versions & 1 rubygems