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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1a62997c7d2c3f990658a361c9db7e9c197b13acacf8ed25f600f862aca6eda
4
- data.tar.gz: a427559b697af802e3048ac24e96fffb783bbbd8ee9e970e28075f39580f3ae0
3
+ metadata.gz: f27889f6d76a5e88ff44237fff80ff0364d9659bc8d656d23a508a6c5950dd44
4
+ data.tar.gz: 102c22650f1cc0e74775efe6b79646bc4f4aec3063aef2a9b8c6c0492849725e
5
5
  SHA512:
6
- metadata.gz: b83c26346790a184c193d577428eb5ed32419f9a68ed9c7e0a60e8a97bf5d4aad654cfdd591fe4e277cace7050bd3b77282967386df58a8e65e878b37fa2863e
7
- data.tar.gz: bd7fdc98ce401fd1012bacb7d123a131163c666d8061f5996b2ef312371b807c87b81cab48c5e8ccbf9b49c2c656b21b1ce61745fac05c72a5e07ff24923e7ea
6
+ metadata.gz: ef4281eae4ac476c5373b3980df1a5680664fa5a29eef206ff11649363e032d50d877dda2c6fb0d568fcd431de8a00653b8f13383f73cd7dbc4054ecfe0c8456
7
+ data.tar.gz: 56581361691afd94738f157cf7b0d85d0fdfe9e449575ca95ea61d5f8c1de0a9c3d329e2a12162c0165082e41425016cb78482a088018128f06ac0a6ab7ecb4c
data/CHANGELOG.md CHANGED
@@ -1,35 +1,26 @@
1
- # Change log
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.1] - 2024-06-08
8
+ ## [0.1.3] - 2024-06-09
9
9
 
10
- ### Added:
10
+ ### Added
11
11
 
12
- - bundle install when running reissue
13
- - handling of brackets in the changelog version numbers
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
- ### Removed:
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
- - dependency on the keepachangelog gem
22
+ ## [0.1.2] - 2024-06-08
30
23
 
31
- ## [0.1.0] - 2024-04-11
32
-
33
- ### Added:
24
+ ### Fixed:
34
25
 
35
- - Initial release
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:
@@ -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
 
@@ -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.join("\n\n")
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 'Finalize the changelog for version '")
88
+ system("git commit -m '#{finalize_message}'")
89
+ else
90
+ system("echo '#{finalize_message}'")
88
91
  end
89
92
  end
90
93
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Reissue
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.3"
5
5
  end
@@ -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 any other symbol.
13
+ # Possible values are :major, :minor, :patch, or :pre.
10
14
  # @return [Gem::Version] The updated version.
11
15
  def redo(segment_name)
12
- if segment_name.to_s == "major"
13
- Gem::Version.new("#{segments[0].to_i + 1}.0.0")
14
- elsif segment_name.to_s == "minor"
15
- Gem::Version.new("#{segments[0]}.#{segments[1].to_i + 1}.0")
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
- Gem::Version.new("#{segments[0]}.#{segments[1]}.#{segments[2].to_i + 1}")
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
- def version_regex = /(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)/
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.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reissue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Gay