Sha256: 77e588aaf53814bc21c666b6378dc345de785251ace9b25fabd448163b1f9989

Contents?: true

Size: 670 Bytes

Versions: 4

Compression:

Stored size: 670 Bytes

Contents

require 'structured_changelog'
require 'structured_changelog/version_pattern'

desc "Set the gem's VERSION constant to be the changelog's version"
task 'changelog:sync', [:changelog_path, :version_path] do |_task, arguments|
  changelog_path = arguments.to_h.fetch(:changelog_path) { "CHANGELOG.md" }
  version_path   = arguments.to_h.fetch(:version_path)   { "lib/#{Pathname.pwd.basename}/version.rb"}

  changelog    = StructuredChangelog.new(changelog_path)
  version_file = Pathname.new(version_path)

  version_file.write(version_file.read.gsub(StructuredChangelog::VersionPattern, changelog.version.to_s))

  puts "Updated gem version to #{changelog.version}"
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
structured_changelog-0.8.3 lib/structured_changelog/tasks/sync.rb
structured_changelog-0.8.2 lib/structured_changelog/tasks/sync.rb
structured_changelog-0.8.1 lib/structured_changelog/tasks/sync.rb
structured_changelog-0.8.0 lib/structured_changelog/tasks/sync.rb