reissue 0.1.5 → 0.1.6

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: fe285dfda18d82a77561abf6281b96f1fb2e3739cbbf5c7b6b072f6e3fe12c94
4
- data.tar.gz: 36c3e171e17214892f9cef24724c3c901cc56406c39218a4239a656ac02a354e
3
+ metadata.gz: 98d162c9fe97d9ebd55f3ead6651db035f574ba3fedbd5108dc8b73207f14d2f
4
+ data.tar.gz: 4cd9b74c2be2f24bf00cea642f454666f0cad712cbcd53107678a3302cae3f71
5
5
  SHA512:
6
- metadata.gz: 189dbe15b33aff0e110d5b823e24cbc8444242f90a7f2e5543a7cce414213d428795dac6c7fedbe1e7eef6b1786238ecae61b4e0ae5e56947ee1e2ef77bac4cd
7
- data.tar.gz: 39a8b27c26db53c0fe31ac39b0b6d0c5cef559bb67d3100b585ab5ee01a29b83907eb3241118dd481e8572647107f27101926ee11144cb1281f64176379f1ff3
6
+ metadata.gz: c73d252f2528d09a79b298853bce7d27c82e786f50e85f3ed77bd13945d7ceeb072d47417f26ea09108bcf1ce55e3f64f9eb09620d7dc098eea44d83053eaa0c
7
+ data.tar.gz: 4df58b81ac4bfaea5c713be2305553b3e754bff512990f2db35cdb08cc3481f284e9a6c77b738378860b424c59fa6fd9209df4436e1e460c8521a425f70d02e9
data/CHANGELOG.md CHANGED
@@ -5,15 +5,18 @@ 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.1.5] - 2024-06-09
8
+ ## [0.1.6] - 2024-06-10
9
+
10
+ ### Added
11
+
12
+ - The ability to specify the version_redo_proc to customize the version number update process.
9
13
 
10
14
  ### Fixed
11
15
 
12
- - Fixed incorrect handling of missing empty last line
16
+ - Incorrect testing of Reissue.reformat
13
17
 
14
- ## [0.1.4] - 2024-06-09
18
+ ## [0.1.5] - 2024-06-09
15
19
 
16
20
  ### Fixed
17
21
 
18
- - Handle changlog files without an empty last line
19
- - Handle empty version_limit in reformat task
22
+ - Fixed incorrect handling of missing empty last line
data/README.md CHANGED
@@ -80,26 +80,31 @@ require "reissue/rake"
80
80
 
81
81
  Reissue::Task.create :your_name_and_namespace do |task|
82
82
 
83
- # Required: The file to update with the new version number.
84
- task.version_file = "path/to/version.rb"
85
-
86
83
  # Optional: The name of the task. Defaults to "reissue".
87
84
  task.name = "your_name_and_namespace"
88
85
 
89
- # Optional: The description of the task.
86
+ # Optional: The description of the main task.
90
87
  task.description = "Prepare the next version of the gem."
91
88
 
92
- # Optional: The file to update with the new version number.
93
- task.changelog_file = "path/to/CHANGELOG.md"
89
+ # Required: The file to update with the new version number.
90
+ task.version_file = "path/to/version.rb"
94
91
 
95
92
  # Optional: The number of versions to maintain in the changelog.
96
93
  task.version_limit = 5
97
94
 
95
+ # Optional: A Proc to format the version number. Receives a Gem::Version object, and segment.
96
+ task.format_version = ->(version, segment) do
97
+ # your special versioning logic
98
+ end
99
+
100
+ # Optional: The file to update with the new version number.
101
+ task.changelog_file = "path/to/CHANGELOG.md"
102
+
98
103
  # Optional: Whether to commit the changes automatically. Defaults to true.
99
104
  task.commit = false
100
105
 
101
106
  # Optional: Whether or not to commit the results of the finalize task. Defaults to true.
102
- task.finalize_commit = false
107
+ task.commit_finalize = false
103
108
  end
104
109
  ```
105
110
 
data/lib/reissue/rake.rb CHANGED
@@ -22,15 +22,18 @@ module Reissue
22
22
  # The path to the version file. Required.
23
23
  attr_accessor :version_file
24
24
 
25
+ # The number of versions to retain in the changelog file. Defaults to 2.
26
+ attr_accessor :version_limit
27
+
28
+ # A proc that can be used to create the new version string.
29
+ attr_accessor :version_redo_proc
30
+
25
31
  # The path to the changelog file.
26
32
  attr_accessor :changelog_file
27
33
 
28
34
  # Additional paths to add to the commit.
29
35
  attr_accessor :updated_paths
30
36
 
31
- # The number of versions to retain in the changelog file. Defaults to 2.
32
- attr_accessor :version_limit
33
-
34
37
  # Whether to commit the changes. Default: true.
35
38
  attr_accessor :commit
36
39
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Reissue
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.6"
5
5
  end
@@ -56,11 +56,12 @@ module Reissue
56
56
  # Initializes a new instance of the VersionUpdater class.
57
57
  #
58
58
  # @param version_file [String] The path to the version file.
59
- def initialize(version_file)
59
+ def initialize(version_file, version_redo_proc: nil)
60
60
  @version_file = version_file
61
61
  @original_version = nil
62
62
  @new_version = nil
63
63
  @updated_body = ""
64
+ @version_redo_proc = version_redo_proc
64
65
  end
65
66
 
66
67
  # Updates the version segment and writes the updated version to the file.
@@ -76,6 +77,18 @@ module Reissue
76
77
  @new_version
77
78
  end
78
79
 
80
+ # A proc that can be used to redo the version string.
81
+ attr_accessor :version_redo_proc
82
+
83
+ # Creates a new version string based on the original version and the specified segment.
84
+ def redo(version, segment)
85
+ if version_redo_proc
86
+ version_redo_proc.call(version, segment)
87
+ else
88
+ version.redo(segment)
89
+ end
90
+ end
91
+
79
92
  # Updates the specified segment of the version string.
80
93
  #
81
94
  # @param segment [Symbol] The segment to update (:major, :minor, or :patch).
@@ -84,7 +97,7 @@ module Reissue
84
97
  version_file = File.read(@version_file)
85
98
  @updated_body = version_file.gsub(version_regex) do |string|
86
99
  @original_version = ::Gem::Version.new(string)
87
- @new_version = ::Gem::Version.new(string).redo(segment).to_s
100
+ @new_version = self.redo(::Gem::Version.new(string), segment).to_s
88
101
  end
89
102
  @new_version
90
103
  end
data/lib/reissue.rb CHANGED
@@ -22,9 +22,10 @@ module Reissue
22
22
  segment: "patch",
23
23
  date: "Unreleased",
24
24
  changes: {},
25
- version_limit: 2
25
+ version_limit: 2,
26
+ version_redo_proc: nil
26
27
  )
27
- version_updater = VersionUpdater.new(version_file)
28
+ version_updater = VersionUpdater.new(version_file, version_redo_proc:)
28
29
  new_version = version_updater.call(segment, version_file:)
29
30
  if changelog_file
30
31
  changelog_updater = ChangelogUpdater.new(changelog_file)
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.1.5
4
+ version: 0.1.6
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-06-09 00:00:00.000000000 Z
11
+ date: 2024-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake