reissue 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4cc74e34e41fc5b950be6012c3b517235f0a6537f30c09ae17c6f8d66240407a
4
- data.tar.gz: 19f8f5b5bb7cdce525e26d3def6c18139462def2b9ac5c936659a7f4608bf213
3
+ metadata.gz: 9ec9aad4eae0a3eaf769c1ae42cc58ca21ad704ff0b82697782fc882600902e7
4
+ data.tar.gz: d98907cd5df4104320b6793caafe4d33333be534c253172b7b6bb7090ff2504e
5
5
  SHA512:
6
- metadata.gz: 84e988380692e405e2e173e2e87cb9e6088328e120640c4a482b3e737985961abe40f1ecadffd674113489f635101d0f75777d56635a3636b054f27c275c1be7
7
- data.tar.gz: 02f0db508076455faf195b7f1b0ecd8d8ab3b1e772e61f335935b48f2bde96aee76aa6a89c9a8e39c44d358fe3d2d70d1fe41c2d4bd2ccdb445c0b103ed4b853
6
+ metadata.gz: 16072744735112068c9b5a4475d2d6d917fad5ffa82772ea59989380f85672a32fe4c6b226cb8db00eef74b7dd1bf328c23f4f60cef42228eb79058cb3f29568
7
+ data.tar.gz: 5554eec13624f10d14bc59fd2b2428f7a1e5803d3a0af15c90810d62490dc8875eba2d57eb8966ec88dd900607dc14c83ae967dba9fb2f658c1e0d3df05724b3
data/CHANGELOG.md CHANGED
@@ -5,20 +5,20 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
6
6
  and this project adheres to [Semantic Versioning](http://semver.org/).
7
7
 
8
- ## [0.3.2] - 2025-01-16
8
+ ## [0.4.0] - 2025-05-08
9
9
 
10
- ### Fixed
10
+ ### Changed
11
+
12
+ - Update reformat task to create a new changelog if it doesn't exist
11
13
 
12
- - Parser will handle nil changes
14
+ ## [0.3.4] - Unreleased
13
15
 
14
- ## [0.3.1] - 2025-01-16
16
+ ## [0.3.3] - 2025-01-17
15
17
 
16
18
  ### Added
17
19
 
18
- - Add `retain_changelogs` option to control how to retain the changelog files for the previous versions.
20
+ - CODEOWNERS file
19
21
 
20
- ### Changed
22
+ ### Fixed
21
23
 
22
- - Set the name of the `reissue:branch` argument to `branch_name` to be clearer.
23
- - Inject the constants in the `create` method.
24
- - Updated the tested Ruby version to 3.4.
24
+ - Properly retain changelog on `reissue:finalize`
data/Rakefile CHANGED
@@ -16,5 +16,5 @@ require_relative "lib/reissue/gem"
16
16
 
17
17
  Reissue::Task.create :reissue do |task|
18
18
  task.version_file = "lib/reissue/version.rb"
19
- task.push_finalize = true
19
+ task.push_finalize = :branch
20
20
  end
data/lib/reissue/rake.rb CHANGED
@@ -142,13 +142,16 @@ module Reissue
142
142
  else
143
143
  args[:version_limit].to_i
144
144
  end
145
+ unless File.exist?(changelog_file)
146
+ formatter.generate_changelog(changelog_file)
147
+ end
145
148
  formatter.reformat(changelog_file, version_limit:, retain_changelogs:)
146
149
  end
147
150
 
148
151
  desc "Finalize the changelog for an unreleased version to set the release date."
149
152
  task "#{name}:finalize", [:date] do |task, args|
150
153
  date = args[:date] || Time.now.strftime("%Y-%m-%d")
151
- version, date = formatter.finalize(date, changelog_file:)
154
+ version, date = formatter.finalize(date, changelog_file:, retain_changelogs:)
152
155
  finalize_message = "Finalize the changelog for version #{version} on #{date}"
153
156
  if commit_finalize
154
157
  tasker["#{name}:branch"].invoke("reissue/#{version}") if finalize_with_branch?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Reissue
4
- VERSION = "0.3.2"
4
+ VERSION = "0.4.0"
5
5
  end
data/lib/reissue.rb CHANGED
@@ -41,9 +41,9 @@ module Reissue
41
41
  # @param changelog_file [String] The path to the changelog file.
42
42
  #
43
43
  # @return [Array] The version number and release date.
44
- def self.finalize(date = Date.today, changelog_file: "CHANGELOG.md")
44
+ def self.finalize(date = Date.today, changelog_file: "CHANGELOG.md", retain_changelogs: false)
45
45
  changelog_updater = ChangelogUpdater.new(changelog_file)
46
- changelog = changelog_updater.finalize(date:, changelog_file:)
46
+ changelog = changelog_updater.finalize(date:, changelog_file:, retain_changelogs:)
47
47
  changelog["versions"].first.slice("version", "date").values
48
48
  end
49
49
 
@@ -56,4 +56,34 @@ module Reissue
56
56
  changelog_updater = ChangelogUpdater.new(file)
57
57
  changelog_updater.reformat(version_limit:, retain_changelogs:)
58
58
  end
59
+
60
+ INITIAL_CHANGES = {
61
+ "Added" => ["Initial release"]
62
+ }
63
+
64
+ def self.generate_changelog(location, changes: {})
65
+ template = <<~EOF
66
+ # Changelog
67
+
68
+ All notable changes to this project will be documented in this file.
69
+
70
+ The format is based on [Keep a Changelog](http://keepachangelog.com/)
71
+ and this project adheres to [Semantic Versioning](http://semver.org/).
72
+
73
+ ## Unreleased
74
+
75
+ ## [0.1.0]
76
+ EOF
77
+
78
+ File.write(location, template)
79
+ changelog_updater = ChangelogUpdater.new(location)
80
+ changelog_updater.call(
81
+ "0.1.0",
82
+ date: "Unreleased",
83
+ changes: changes.empty? ? INITIAL_CHANGES : changes,
84
+ changelog_file: location,
85
+ version_limit: 1,
86
+ retain_changelogs: false
87
+ )
88
+ end
59
89
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reissue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Gay
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-01-16 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rake
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
63
  - !ruby/object:Gem::Version
64
64
  version: '0'
65
65
  requirements: []
66
- rubygems_version: 3.6.2
66
+ rubygems_version: 3.6.7
67
67
  specification_version: 4
68
68
  summary: Keep your versions and changelogs up to date and prepared for release.
69
69
  test_files: []