reissue 0.1.4 → 0.1.6

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: a7c66c77dcfbdb035092802d02176419055145251987dda7cfc528c33cea8fce
4
- data.tar.gz: 25a7dcf2f67a043c4f35bb779fa8603eac936f1633d71915068581beff1295af
3
+ metadata.gz: 98d162c9fe97d9ebd55f3ead6651db035f574ba3fedbd5108dc8b73207f14d2f
4
+ data.tar.gz: 4cd9b74c2be2f24bf00cea642f454666f0cad712cbcd53107678a3302cae3f71
5
5
  SHA512:
6
- metadata.gz: c0f14e1bd96f8da42a1cf5b55485c26b2dcf941200228b0032ec0a1686b71e23c37ff73ee4925422744c4a0818be15bb20dffb0e8f64f8d5e8bc991f97181e0d
7
- data.tar.gz: 8d2e7d47bc7a8d81238370cd635f5998c01a3091894da80524473aafd3e4d628423896101f6f91478d3427ed278553703215dfd77ea2c5971bbb6391860ccf4d
6
+ metadata.gz: c73d252f2528d09a79b298853bce7d27c82e786f50e85f3ed77bd13945d7ceeb072d47417f26ea09108bcf1ce55e3f64f9eb09620d7dc098eea44d83053eaa0c
7
+ data.tar.gz: 4df58b81ac4bfaea5c713be2305553b3e754bff512990f2db35cdb08cc3481f284e9a6c77b738378860b424c59fa6fd9209df4436e1e460c8521a425f70d02e9
data/CHANGELOG.md CHANGED
@@ -5,23 +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.4] - 2024-06-09
8
+ ## [0.1.6] - 2024-06-10
9
9
 
10
- ### Fixed
10
+ ### Added
11
11
 
12
- - Handle changlog files without an empty last line
13
- - Handle empty version_limit in reformat task
12
+ - The ability to specify the version_redo_proc to customize the version number update process.
14
13
 
15
- ## [0.1.3] - 2024-06-09
14
+ ### Fixed
16
15
 
17
- ### Added
16
+ - Incorrect testing of Reissue.reformat
18
17
 
19
- - Support for alhpa characters in version numbers
20
- - Support for English names for Greek alphabet letters in version numbers
18
+ ## [0.1.5] - 2024-06-09
21
19
 
22
20
  ### Fixed
23
21
 
24
- - Reissue.finalize returns the version and value as an array
25
- - Documentation on the refined redo method in Gem::Version
26
- - Limit major numbers to Integers
27
- - Handle empty changelog files
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/Rakefile CHANGED
@@ -15,7 +15,6 @@ task default: :test
15
15
  require_relative "lib/reissue/gem"
16
16
 
17
17
  Reissue::Task.create :reissue do |task|
18
- task.updated_paths << "checksums"
19
18
  task.version_file = "lib/reissue/version.rb"
20
19
  task.commit = true
21
20
  end
@@ -13,7 +13,7 @@ module Reissue
13
13
  end
14
14
 
15
15
  def parse
16
- scanner = StringScanner.new(@changelog)
16
+ scanner = StringScanner.new(@changelog) << "\n"
17
17
  @parts << parse_title(scanner)
18
18
  @parts << parse_preamble(scanner)
19
19
  @parts << parse_versions(scanner)
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.4"
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.4
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