reissue 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -22
- data/README.md +9 -0
- data/lib/reissue/parser.rb +3 -3
- data/lib/reissue/printer.rb +9 -3
- data/lib/reissue/rake.rb +5 -2
- data/lib/reissue/version.rb +1 -1
- data/lib/reissue/version_updater.rb +41 -10
- data/lib/reissue.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f27889f6d76a5e88ff44237fff80ff0364d9659bc8d656d23a508a6c5950dd44
|
4
|
+
data.tar.gz: 102c22650f1cc0e74775efe6b79646bc4f4aec3063aef2a9b8c6c0492849725e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef4281eae4ac476c5373b3980df1a5680664fa5a29eef206ff11649363e032d50d877dda2c6fb0d568fcd431de8a00653b8f13383f73cd7dbc4054ecfe0c8456
|
7
|
+
data.tar.gz: 56581361691afd94738f157cf7b0d85d0fdfe9e449575ca95ea61d5f8c1de0a9c3d329e2a12162c0165082e41425016cb78482a088018128f06ac0a6ab7ecb4c
|
data/CHANGELOG.md
CHANGED
@@ -1,35 +1,26 @@
|
|
1
|
-
#
|
1
|
+
# Changelog
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
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.
|
8
|
+
## [0.1.3] - 2024-06-09
|
9
9
|
|
10
|
-
### Added
|
10
|
+
### Added
|
11
11
|
|
12
|
-
-
|
13
|
-
-
|
14
|
-
- Reissue::Parser class to parse the changelog file
|
15
|
-
- Reissue::Printer class to print the changelog file
|
16
|
-
- Reissue::Task class to handle the creation of reissue tasks
|
17
|
-
- Return version and date from Reissue.finalize
|
18
|
-
- Ability to limit the number of versions to maintain
|
19
|
-
- Gem release support
|
20
|
-
- Description of how to use and configure the gem in the README.md
|
12
|
+
- Support for alhpa characters in version numbers
|
13
|
+
- Support for English names for Greek alphabet letters in version numbers
|
21
14
|
|
22
|
-
### Fixed
|
23
|
-
|
24
|
-
- bug in tests loading the changelog fixture
|
25
|
-
- format of the changelog file
|
15
|
+
### Fixed
|
26
16
|
|
27
|
-
|
17
|
+
- Reissue.finalize returns the version and value as an array
|
18
|
+
- Documentation on the refined redo method in Gem::Version
|
19
|
+
- Limit major numbers to Integers
|
20
|
+
- Handle empty changelog files
|
28
21
|
|
29
|
-
|
22
|
+
## [0.1.2] - 2024-06-08
|
30
23
|
|
31
|
-
|
32
|
-
|
33
|
-
### Added:
|
24
|
+
### Fixed:
|
34
25
|
|
35
|
-
-
|
26
|
+
- Fix references to Gem::Version from the top level
|
data/README.md
CHANGED
@@ -12,6 +12,15 @@ update the changelog with a new version and a date.
|
|
12
12
|
|
13
13
|
Use Reissue to prepare your first commit going into the new version.
|
14
14
|
|
15
|
+
Standard procedure for releasing projects with Reissue:
|
16
|
+
|
17
|
+
1. Create a version with some number like 0.1.0.
|
18
|
+
2. Add commits to the project. These will be associated with the version 0.1.0.
|
19
|
+
3. When you are releasing your project, finalize it by running
|
20
|
+
`rake reissue:finalize` to update the Unreleased version in your changelog.
|
21
|
+
4. Bump the version to 0.1.1 with `rake reissue[patch]` and commit those changes.
|
22
|
+
Future commits will be associated with the version 0.1.1 until your next release.
|
23
|
+
|
15
24
|
## Installation
|
16
25
|
|
17
26
|
Install the gem and add to the application's Gemfile by executing:
|
data/lib/reissue/parser.rb
CHANGED
@@ -30,14 +30,14 @@ module Reissue
|
|
30
30
|
|
31
31
|
def parse_title(scanner)
|
32
32
|
scanner.scan(/# ([\w\s]+)$/)
|
33
|
-
title = scanner[1].strip
|
33
|
+
title = scanner[1].to_s.strip
|
34
34
|
{"title" => title}
|
35
35
|
end
|
36
36
|
|
37
37
|
def parse_preamble(scanner)
|
38
38
|
preamble = scanner.scan_until(VERSION_MATCH)
|
39
|
-
preamble = preamble.gsub(VERSION_BREAK, "").strip
|
40
|
-
scanner.unscan
|
39
|
+
preamble = preamble.to_s.gsub(VERSION_BREAK, "").strip
|
40
|
+
scanner.unscan unless preamble.empty?
|
41
41
|
{"preamble" => preamble.strip}
|
42
42
|
end
|
43
43
|
|
data/lib/reissue/printer.rb
CHANGED
@@ -2,8 +2,8 @@ module Reissue
|
|
2
2
|
class Printer
|
3
3
|
def initialize(changelog)
|
4
4
|
@changelog = changelog
|
5
|
-
@title = @changelog["title"]
|
6
|
-
@preamble = @changelog["preamble"]
|
5
|
+
@title = @changelog["title"] || "Changelog"
|
6
|
+
@preamble = @changelog["preamble"] || "All project changes are documented in this file."
|
7
7
|
@versions = versions
|
8
8
|
end
|
9
9
|
|
@@ -29,7 +29,13 @@ module Reissue
|
|
29
29
|
format_section(section, changes)
|
30
30
|
end.join("\n\n")
|
31
31
|
[version_string, changes_string].filter_map { |str| str unless str.empty? }.join("\n\n")
|
32
|
-
end.
|
32
|
+
end.then do |data|
|
33
|
+
if data.empty?
|
34
|
+
"## [0.0.0] - Unreleased"
|
35
|
+
else
|
36
|
+
data.join("\n\n")
|
37
|
+
end
|
38
|
+
end
|
33
39
|
end
|
34
40
|
|
35
41
|
def format_section(section, changes)
|
data/lib/reissue/rake.rb
CHANGED
@@ -81,10 +81,13 @@ module Reissue
|
|
81
81
|
desc "Finalize the changelog for an unreleased version to set the release date."
|
82
82
|
task "#{name}:finalize", [:date] do |task, args|
|
83
83
|
date = args[:date] || Time.now.strftime("%Y-%m-%d")
|
84
|
-
Reissue.finalize(date, changelog_file:)
|
84
|
+
version, date = Reissue.finalize(date, changelog_file:)
|
85
|
+
finalize_message = "Finalize the changelog for version #{version} on #{date}"
|
85
86
|
if commit_finalize
|
86
87
|
system("git add -u")
|
87
|
-
system("git commit -m '
|
88
|
+
system("git commit -m '#{finalize_message}'")
|
89
|
+
else
|
90
|
+
system("echo '#{finalize_message}'")
|
88
91
|
end
|
89
92
|
end
|
90
93
|
end
|
data/lib/reissue/version.rb
CHANGED
@@ -1,20 +1,50 @@
|
|
1
1
|
module Reissue
|
2
|
+
module_function def greeks
|
3
|
+
%w[alpha beta gamma delta epsilon zeta eta theta kappa lambda mu nu xi omicron pi rho sigma tau upsilon phi chi psi omega]
|
4
|
+
end
|
5
|
+
|
2
6
|
# Provides versioning functionality for the application.
|
3
7
|
module Versioning
|
4
8
|
# Provides versioning functionality for the application.
|
5
|
-
refine Gem::Version do
|
9
|
+
refine ::Gem::Version do
|
6
10
|
# Redoes the version based on the specified segment_name.
|
7
11
|
#
|
8
12
|
# @param segment_name [Symbol] The segment_name to redo the version.
|
9
|
-
# Possible values are :major, :minor, or
|
13
|
+
# Possible values are :major, :minor, :patch, or :pre.
|
10
14
|
# @return [Gem::Version] The updated version.
|
11
15
|
def redo(segment_name)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
+
new_segments = case segment_name.to_sym
|
17
|
+
when :major
|
18
|
+
[segments[0].next, 0, 0]
|
19
|
+
when :minor
|
20
|
+
[segments[0], segments[1].next, 0]
|
21
|
+
when :patch
|
22
|
+
segments.slice(0, 2) + segments.slice(2..-1).then { |array|
|
23
|
+
array[-1] = array[-1].next
|
24
|
+
[array.map(&:to_s).join]
|
25
|
+
}
|
26
|
+
when :pre
|
27
|
+
segments.slice(0, 3) + segments.slice(3..-1).then { |array|
|
28
|
+
array[-1] = array[-1].next
|
29
|
+
[array.map(&:to_s).join]
|
30
|
+
}
|
31
|
+
else
|
32
|
+
raise ArgumentError, "Invalid segment name: #{segment_name}"
|
33
|
+
end
|
34
|
+
::Gem::Version.create(new_segments.join("."))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
refine ::String do
|
39
|
+
def greek?
|
40
|
+
Reissue.greeks.include?(downcase)
|
41
|
+
end
|
42
|
+
|
43
|
+
def next
|
44
|
+
if greek?
|
45
|
+
Reissue.greeks[Reissue.greeks.index(downcase).next]
|
16
46
|
else
|
17
|
-
|
47
|
+
succ
|
18
48
|
end
|
19
49
|
end
|
20
50
|
end
|
@@ -53,8 +83,8 @@ module Reissue
|
|
53
83
|
def update(segment)
|
54
84
|
version_file = File.read(@version_file)
|
55
85
|
@updated_body = version_file.gsub(version_regex) do |string|
|
56
|
-
@original_version = Gem::Version.new(string)
|
57
|
-
@new_version = Gem::Version.new(string).redo(segment).to_s
|
86
|
+
@original_version = ::Gem::Version.new(string)
|
87
|
+
@new_version = ::Gem::Version.new(string).redo(segment).to_s
|
58
88
|
end
|
59
89
|
@new_version
|
60
90
|
end
|
@@ -62,7 +92,8 @@ module Reissue
|
|
62
92
|
# Regular expression pattern for matching the version string.
|
63
93
|
#
|
64
94
|
# @return [Regexp] The version regex pattern.
|
65
|
-
|
95
|
+
VERSION_MATCH = /(?<major>\d+)\.(?<minor>[a-zA-Z\d]+)\.(?<patch>[a-zA-Z\d]+)(?<add>\.(?<pre>[a-zA-Z\d]+))?/
|
96
|
+
def version_regex = VERSION_MATCH
|
66
97
|
|
67
98
|
# Writes the updated version to the specified file.
|
68
99
|
#
|
data/lib/reissue.rb
CHANGED
@@ -42,7 +42,7 @@ module Reissue
|
|
42
42
|
def self.finalize(date = Date.today, changelog_file: "CHANGELOG.md")
|
43
43
|
changelog_updater = ChangelogUpdater.new(changelog_file)
|
44
44
|
changelog = changelog_updater.finalize(date:, changelog_file:)
|
45
|
-
changelog["versions"].first.slice("version", "date")
|
45
|
+
changelog["versions"].first.slice("version", "date").values
|
46
46
|
end
|
47
47
|
|
48
48
|
# Reformats the changelog file to ensure it is correctly formatted.
|