reissue 0.2.1 → 0.3.0

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: b279a283d58ba13af326acf3eec52c805deffd80bfc0cd6e4e9a7d320cc9dd0f
4
+ data.tar.gz: 4394e68a43bb33c0068fcb9869dac6bfa4f1a27bdd890afe2e65d3cdd2fe1cd6
5
5
  SHA512:
6
- metadata.gz: 9b7adacabff52f5c82e2a0f703d2f808174caf2af29fd244200ea9f0f9ff91887a31336d69ed0d8e37ff52084128fc01677e70d0fc5d3c12b738ada62f916ede
7
- data.tar.gz: 330d439a724f349bc7b1f18ee1a47ca7fecf913749452d460894d5e659a8a7fcc80e13140f6b78d3c36d66ec7d28caa6110877e0cf742a191b6203676ee7bd67
6
+ metadata.gz: 7d1d3335bf01a5563b93cf3dd4ba030f2e851a5a5cbbbfd23d38e9fdcda21634fa4cd0fb6cfe3fd9ba0b56bf55f3ab744116d77b38dadbda98844676dccd9a88
7
+ data.tar.gz: 3ece0d9ecfe89e38c0dfef00304acaf1502760a7e9c3759f380d18b9698e2f1233e8cc2716d0c1184a00a11f5c7c457e4d386adf63dbabcd70ec0fb43f001eb4
data/CHANGELOG.md CHANGED
@@ -5,26 +5,14 @@ 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.3.0] - 2024-09-06
9
9
 
10
10
  ### Added
11
11
 
12
- - Release notes and the checksum for the 0.2.0 version
12
+ - Add `push_reissue` option to control pushing changes to the remote repository.
13
13
 
14
14
  ### Changed
15
15
 
16
- - Return the new version from the reissue task
16
+ - Default behavior of _this_ gem's release is to push finalize without a branch.
17
17
 
18
- ## [0.2.0] - 2024-07-02
19
-
20
- ### Added
21
-
22
- - Reissue::Markdown class to implement the Reissue::Parser.parse behavior
23
-
24
- ### Removed
25
-
26
- - Reissue::Parser implementation
27
-
28
- ### Fixed
29
-
30
- - Handle multiline changes
18
+ ## [0.2.3] - Unreleased
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 = true
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,22 @@ 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
+
55
+ # Whether to push the changes when a new version is created. Default: :branch.
56
+ # Requires commit to be true.
57
+ #
58
+ # Set this to false to disable pushing.
59
+ # Set this to true to push to the current branch.
60
+ # Set this to :branch to push to a new branch.
61
+ attr_accessor :push_reissue
62
+
43
63
  def initialize(name = :reissue)
44
64
  @name = name
45
65
  @description = "Prepare the code for work on a new version."
@@ -48,8 +68,26 @@ module Reissue
48
68
  @changelog_file = "CHANGELOG.md"
49
69
  @commit = true
50
70
  @commit_finalize = true
71
+ @push_finalize = false
51
72
  @version_limit = 2
52
73
  @version_redo_proc = nil
74
+ @push_reissue = :branch
75
+ end
76
+
77
+ def finalize_with_branch?
78
+ push_finalize == :branch
79
+ end
80
+
81
+ def push_finalize?
82
+ !!push_finalize
83
+ end
84
+
85
+ def reissue_version_with_branch?
86
+ push_reissue == :branch
87
+ end
88
+
89
+ def push_reissue?
90
+ !!push_reissue
53
91
  end
54
92
 
55
93
  def define
@@ -70,7 +108,11 @@ module Reissue
70
108
 
71
109
  bump_message = "Bump version to #{new_version}"
72
110
  if commit
111
+ if reissue_version_with_branch?
112
+ Rake::Task["#{name}:branch"].invoke("reissue/#{new_version}")
113
+ end
73
114
  system("git commit -m '#{bump_message}'")
115
+ Rake::Task["#{name}:push"].invoke if push_reissue?
74
116
  else
75
117
  system("echo '#{bump_message}'")
76
118
  end
@@ -94,12 +136,25 @@ module Reissue
94
136
  version, date = Reissue.finalize(date, changelog_file:)
95
137
  finalize_message = "Finalize the changelog for version #{version} on #{date}"
96
138
  if commit_finalize
139
+ Rake::Task["#{name}:branch"].invoke("reissue/#{version}") if finalize_with_branch?
97
140
  system("git add -u")
98
141
  system("git commit -m '#{finalize_message}'")
142
+ Rake::Task["#{name}:push"].invoke if push_finalize?
99
143
  else
100
144
  system("echo '#{finalize_message}'")
101
145
  end
102
146
  end
147
+
148
+ desc "Create a new branch for the next version."
149
+ task "#{name}:branch", [:branch] do |task, args|
150
+ raise "No branch name specified" unless args[:branch]
151
+ system("git checkout -b #{args[:branch]}")
152
+ end
153
+
154
+ desc "Push the current branch to the remote repository."
155
+ task "#{name}:push" do
156
+ system("git push origin HEAD")
157
+ end
103
158
  end
104
159
  end
105
160
  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.3.0"
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.3.0
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