reissue 0.1.2 → 0.1.4

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: a7c66c77dcfbdb035092802d02176419055145251987dda7cfc528c33cea8fce
4
+ data.tar.gz: 25a7dcf2f67a043c4f35bb779fa8603eac936f1633d71915068581beff1295af
5
5
  SHA512:
6
- metadata.gz: 630f0b9db095f1359e149608dc50ce631fc07d335d8d201a5b5741d1f8cd721d450a83d73876bf0c4666347c8bf789c40155fad2b344624ba81718ef102008c3
7
- data.tar.gz: 4b4895ec2553559d86bb8fb45f785f60746d34f952e2cd494aed70ceb5f67320660c0a49bd7c5c8b13b4551f71aab2449ce93b1124931949b461e193fadcf4ab
6
+ metadata.gz: c0f14e1bd96f8da42a1cf5b55485c26b2dcf941200228b0032ec0a1686b71e23c37ff73ee4925422744c4a0818be15bb20dffb0e8f64f8d5e8bc991f97181e0d
7
+ data.tar.gz: 8d2e7d47bc7a8d81238370cd635f5998c01a3091894da80524473aafd3e4d628423896101f6f91478d3427ed278553703215dfd77ea2c5971bbb6391860ccf4d
data/CHANGELOG.md CHANGED
@@ -1,35 +1,27 @@
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.4] - 2024-06-09
9
9
 
10
- ### Fixed:
10
+ ### Fixed
11
11
 
12
- - Fix references to Gem::Version from the top level
12
+ - Handle changlog files without an empty last line
13
+ - Handle empty version_limit in reformat task
13
14
 
14
- ## [0.1.1] - 2024-06-08
15
+ ## [0.1.3] - 2024-06-09
15
16
 
16
- ### Added:
17
+ ### Added
17
18
 
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
19
+ - Support for alhpa characters in version numbers
20
+ - Support for English names for Greek alphabet letters in version numbers
27
21
 
28
- ### Fixed:
22
+ ### Fixed
29
23
 
30
- - bug in tests loading the changelog fixture
31
- - format of the changelog file
32
-
33
- ### Removed:
34
-
35
- - dependency on the keepachangelog gem
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
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/Rakefile CHANGED
@@ -17,5 +17,5 @@ require_relative "lib/reissue/gem"
17
17
  Reissue::Task.create :reissue do |task|
18
18
  task.updated_paths << "checksums"
19
19
  task.version_file = "lib/reissue/version.rb"
20
- task.commit = false
20
+ task.commit = true
21
21
  end
@@ -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
 
@@ -67,7 +67,9 @@ module Reissue
67
67
  scanner.skip(/\s+/)
68
68
 
69
69
  next_line = scanner.scan_until(/\n/)
70
- if next_line.nil? || next_line.strip.empty? || next_line.match?(VERSION_MATCH)
70
+ if next_line.nil? || next_line.strip.empty?
71
+ return changes
72
+ elsif next_line.match?(VERSION_MATCH)
71
73
  scanner.unscan
72
74
  return changes
73
75
  end
@@ -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
@@ -74,7 +74,11 @@ module Reissue
74
74
 
75
75
  desc "Reformat the changelog file to ensure it is correctly formatted."
76
76
  task "#{name}:reformat", [:version_limit] do |task, args|
77
- version_limit = args[:version_limit].to_i || version_limit
77
+ version_limit = if args[:version_limit].nil?
78
+ self.version_limit
79
+ else
80
+ args[:version_limit].to_i
81
+ end
78
82
  Reissue.reformat(changelog_file, version_limit:)
79
83
  end
80
84
 
@@ -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.4"
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.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Gay