reissue 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b4d0a53280207aedc9381894922ca1efb28e0acb20d5bd97bbcb7fe2cd6a7cc
4
- data.tar.gz: d649658ae57c53e5d3e78c5096d9248ddf941f85c074e1e3543e0eeda12678d2
3
+ metadata.gz: d7a30f436a8c3bdf476c8ef3a7547536e292b3b81cf207ff8efe92404eacf2e9
4
+ data.tar.gz: 20d5e0d023af7778e0de3d71859088b5baa216bc00c7ef09a46732e1dcc0712a
5
5
  SHA512:
6
- metadata.gz: 9b7adacabff52f5c82e2a0f703d2f808174caf2af29fd244200ea9f0f9ff91887a31336d69ed0d8e37ff52084128fc01677e70d0fc5d3c12b738ada62f916ede
7
- data.tar.gz: 330d439a724f349bc7b1f18ee1a47ca7fecf913749452d460894d5e659a8a7fcc80e13140f6b78d3c36d66ec7d28caa6110877e0cf742a191b6203676ee7bd67
6
+ metadata.gz: fea5c4c4d7c7c4d7abcd43d038e9566de875892ee2cda0e95730f69c4108fd3a0304f99ec5ab3bcdd17b104719280b7610061973217eb9fc1277d265cb017238
7
+ data.tar.gz: 24a0fcfb969d6ba3640e3594a268cd192aa5b7316b49e88aa7059f918bfdb9fb0728aaf81df11cd3a61950ffea47af6c30d07725c12c6bdeac5ff742f08991e9
data/CHANGELOG.md CHANGED
@@ -5,26 +5,24 @@ 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.2.1] - 2024-07-29
8
+ ## [0.2.2] - 2024-09-06
9
9
 
10
10
  ### Added
11
11
 
12
- - Release notes and the checksum for the 0.2.0 version
12
+ - Add a `reissue:branch` task to create a new branch for the next version
13
+ - Add a `reissue:push` task to push the new branch to the remote repository
13
14
 
14
- ### Changed
15
+ ### Fixed
15
16
 
16
- - Return the new version from the reissue task
17
+ - Require the 'date' library in tests to ensure the Date constant is present
18
+ - Ensure that `updated_paths` are always enumerable
17
19
 
18
- ## [0.2.0] - 2024-07-02
20
+ ## [0.2.1] - 2024-07-29
19
21
 
20
22
  ### Added
21
23
 
22
- - Reissue::Markdown class to implement the Reissue::Parser.parse behavior
23
-
24
- ### Removed
25
-
26
- - Reissue::Parser implementation
24
+ - Release notes and the checksum for the 0.2.0 version
27
25
 
28
- ### Fixed
26
+ ### Changed
29
27
 
30
- - Handle multiline changes
28
+ - Return the new version from the reissue task
data/README.md CHANGED
@@ -52,6 +52,10 @@ This will add the following rake tasks:
52
52
  the latest version.
53
53
  - `rake reissue:reformat[version_limit]` - Reformat the CHANGELOG.md file and
54
54
  optionally limit the number of versions to maintain.
55
+ - `rake reissue:branch[branch-name]` - Create a new branch for the next version.
56
+ Controlled by the `push_finalize` and `commit_finalize` options.
57
+ - `rake reissue:push` - Push the changes to the remote repository. Controlled
58
+ by the `push_finalize` and `commit_finalize` options.
55
59
 
56
60
  This will also update the `build` task from rubygems to first run
57
61
  `reissue:finalize` and then build the gem, ensuring that your changelog is
@@ -105,6 +109,9 @@ Reissue::Task.create :your_name_and_namespace do |task|
105
109
 
106
110
  # Optional: Whether or not to commit the results of the finalize task. Defaults to true.
107
111
  task.commit_finalize = false
112
+
113
+ # Optional: Whether to push the changes automatically. Defaults to false.
114
+ task.push_finalize = :branch # or false, or true to push the working branch
108
115
  end
109
116
  ```
110
117
 
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.commit = true
19
+ task.push_finalize = :branch
20
20
  end
@@ -28,7 +28,7 @@ module Reissue
28
28
  changes_string = changes.map do |section, section_changes|
29
29
  format_section(section, section_changes)
30
30
  end.join("\n\n")
31
- [version_string, changes_string].filter_map { |str| str unless str.empty? }.join("\n\n")
31
+ [version_string, changes_string].reject { |str| str.empty? }.join("\n\n")
32
32
  end.then do |data|
33
33
  if data.empty?
34
34
  "## [0.0.0] - Unreleased"
data/lib/reissue/rake.rb CHANGED
@@ -32,7 +32,11 @@ module Reissue
32
32
  attr_accessor :changelog_file
33
33
 
34
34
  # Additional paths to add to the commit.
35
- attr_accessor :updated_paths
35
+ attr_writer :updated_paths
36
+
37
+ def updated_paths
38
+ Array(@updated_paths)
39
+ end
36
40
 
37
41
  # Whether to commit the changes. Default: true.
38
42
  attr_accessor :commit
@@ -40,6 +44,14 @@ module Reissue
40
44
  # Whether to commit the finalize change to the changelog. Default: true.
41
45
  attr_accessor :commit_finalize
42
46
 
47
+ # Whether to branch and push the changes. Default: :branch.
48
+ # Requires commit_finialize to be true.
49
+ #
50
+ # Set this to false to disable pushing.
51
+ # Set this to true to push to the current branch.
52
+ # Set this to :branch to push to a new branch.
53
+ attr_accessor :push_finalize
54
+
43
55
  def initialize(name = :reissue)
44
56
  @name = name
45
57
  @description = "Prepare the code for work on a new version."
@@ -48,10 +60,19 @@ module Reissue
48
60
  @changelog_file = "CHANGELOG.md"
49
61
  @commit = true
50
62
  @commit_finalize = true
63
+ @push_finalize = false
51
64
  @version_limit = 2
52
65
  @version_redo_proc = nil
53
66
  end
54
67
 
68
+ def finalize_with_branch?
69
+ push_finalize == :branch
70
+ end
71
+
72
+ def push_finalize?
73
+ !!push_finalize
74
+ end
75
+
55
76
  def define
56
77
  desc description
57
78
  task name, [:segment] do |task, args|
@@ -94,12 +115,25 @@ module Reissue
94
115
  version, date = Reissue.finalize(date, changelog_file:)
95
116
  finalize_message = "Finalize the changelog for version #{version} on #{date}"
96
117
  if commit_finalize
118
+ Rake::Task["#{name}:branch"].invoke("reissue/#{version}") if finalize_with_branch?
97
119
  system("git add -u")
98
120
  system("git commit -m '#{finalize_message}'")
121
+ Rake::Task["#{name}:push"].invoke if push_finalize?
99
122
  else
100
123
  system("echo '#{finalize_message}'")
101
124
  end
102
125
  end
126
+
127
+ desc "Create a new branch for the next version."
128
+ task "#{name}:branch", [:branch] do |task, args|
129
+ raise "No branch name specified" unless args[:branch]
130
+ system("git checkout -b #{args[:branch]}")
131
+ end
132
+
133
+ desc "Push the current branch to the remote repository."
134
+ task "#{name}:push" do
135
+ system("git push origin HEAD")
136
+ end
103
137
  end
104
138
  end
105
139
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Reissue
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reissue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Gay
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-29 00:00:00.000000000 Z
11
+ date: 2024-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake