reissue 0.1.2 → 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: 024d6b70e3274ab27dea97225976e56c5371f8f84d01663bb6c033bd4b36ec70
4
- data.tar.gz: 8fa3b6412648813f302916e7a43b0ad753b8f917064c126f070a4e8edd2976be
3
+ metadata.gz: f27889f6d76a5e88ff44237fff80ff0364d9659bc8d656d23a508a6c5950dd44
4
+ data.tar.gz: 102c22650f1cc0e74775efe6b79646bc4f4aec3063aef2a9b8c6c0492849725e
5
5
  SHA512:
6
- metadata.gz: 630f0b9db095f1359e149608dc50ce631fc07d335d8d201a5b5741d1f8cd721d450a83d73876bf0c4666347c8bf789c40155fad2b344624ba81718ef102008c3
7
- data.tar.gz: 4b4895ec2553559d86bb8fb45f785f60746d34f952e2cd494aed70ceb5f67320660c0a49bd7c5c8b13b4551f71aab2449ce93b1124931949b461e193fadcf4ab
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.2] - 2024-06-08
8
+ ## [0.1.3] - 2024-06-09
9
9
 
10
- ### Fixed:
10
+ ### Added
11
11
 
12
- - Fix references to Gem::Version from the top level
12
+ - Support for alhpa characters in version numbers
13
+ - Support for English names for Greek alphabet letters in version numbers
13
14
 
14
- ## [0.1.1] - 2024-06-08
15
+ ### Fixed
15
16
 
16
- ### Added:
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
17
21
 
18
- - bundle install when running reissue
19
- - handling of brackets in the changelog version numbers
20
- - Reissue::Parser class to parse the changelog file
21
- - Reissue::Printer class to print the changelog file
22
- - Reissue::Task class to handle the creation of reissue tasks
23
- - Return version and date from Reissue.finalize
24
- - Ability to limit the number of versions to maintain
25
- - Gem release support
26
- - Description of how to use and configure the gem in the README.md
22
+ ## [0.1.2] - 2024-06-08
27
23
 
28
24
  ### Fixed:
29
25
 
30
- - bug in tests loading the changelog fixture
31
- - format of the changelog file
32
-
33
- ### Removed:
34
-
35
- - dependency on the keepachangelog gem
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Reissue
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
@@ -1,4 +1,8 @@
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.
@@ -6,15 +10,41 @@ module Reissue
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
@@ -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.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Gay