gfsm 0.3.0 → 0.3.1

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: b9e0ba6497503d24cc631e5a561879a5b8fddd9b0b98243b4b92d2f05f5add90
4
- data.tar.gz: ac56fb2b77daf823e235cf7c06e6ca8ad29d585f261e83a90506efe7a3f30fd2
3
+ metadata.gz: f1328d98b44c0777e42445b9ef8f67b9b88e37d8a7bdc517a3e6393b2543d2a3
4
+ data.tar.gz: 5ee4cf826f1c4b608bad7f58193db6c744e4c33868f31c5b477994a475bc69d6
5
5
  SHA512:
6
- metadata.gz: 99373328bcc6e18fa2bd4c588a98fca5ff359fa83c2f1281049236a23f5f8631aafb9676ab813461dd2a6b87a89a83a3b595cc81db9d7266f141d412ca0c8f61
7
- data.tar.gz: 1928c819f0a3bc20d324cacfb038506ed6eaf0cacb425070bcd09c4f85ea65bde18374cd4029aa2808552b2e6a71f4e46169811a3404e034177f9c0c32a2ab66
6
+ metadata.gz: 50c2d64b74ed354024fffb5825c28e309e9ddfcdd99889613b2c12cbef85f4ee32cae3c3089e8e5a466bfc0c7abd150d1398c9a3f13bc57df81472ff57640c59
7
+ data.tar.gz: 178a21e2f2212bc7427bb0ac4b894ae83b4b3846ed1e9bd2b29287ba30500012397a69bdc77f8d408020ca055891f495bad7774a40a18c5d66ff63928ae8faf6
data/lib/gfsm.rb CHANGED
@@ -7,11 +7,11 @@ require 'data/configuration'
7
7
  require 'data/version'
8
8
 
9
9
  # Load the tools
10
- require 'tools/commits_extractor'
11
10
  require 'tools/commits_subdivider'
12
11
  require 'tools/current_version_loader'
13
- require 'tools/version_bumper'
12
+ require 'tools/git_utilities'
14
13
  require 'tools/output'
14
+ require 'tools/version_bumper'
15
15
 
16
16
  # Load the commands
17
17
  require 'commands/base_command'
@@ -7,13 +7,9 @@ module GFSM
7
7
  module Tools
8
8
  class CurrentVersionLoader
9
9
  def self.load_current_version(repo_path = ".")
10
- repo = Git.open(repo_path)
11
-
12
- begin
13
- last_tag_name = repo.describe(nil, { :tags => true, :abbrev => 0 })
14
- rescue
15
- last_tag_name = nil
16
- end
10
+ last_tag_name = GFSM::Tools::GitUtilities.extract_last_tag_name(
11
+ GFSM::Tools::GitUtilities.load_repo(repo_path)
12
+ )
17
13
 
18
14
  return GFSM::Data::Version.new("0.0.0") unless last_tag_name
19
15
 
@@ -4,17 +4,28 @@ require 'git'
4
4
 
5
5
  module GFSM
6
6
  module Tools
7
- class CommitsExtractor
7
+ class GitUtilities
8
8
  CHANGELOG_TRAILER_REGEX = /^(?<name>Changelog):\s*(?<category>.+)$/i
9
9
 
10
- def self.extract_commits_with_changelog_trailer(repo_path = ".")
11
- repo = Git.open(repo_path)
10
+ def self.load_repo(repo_path)
11
+ Git.open(repo_path)
12
+ end
12
13
 
14
+ def self.extract_last_tag_name(repo)
13
15
  begin
14
- last_tag_name = repo.describe(nil, { :tags => true, :abbrev => 0 })
16
+ current_sort_order = repo.config("tag.sort")
17
+
18
+ repo.config("tag.sort", "-v:refname")
19
+ tags = repo.tags
20
+ repo.config("tag.sort", current_sort_order)
21
+
22
+ tags[0].name if !tags.empty?
15
23
  rescue
16
- last_tag_name = nil
17
24
  end
25
+ end
26
+
27
+ def self.extract_commits_with_changelog_trailer(repo)
28
+ last_tag_name = self.extract_last_tag_name(repo)
18
29
 
19
30
  begin
20
31
  commits = last_tag_name ? repo.log.between(last_tag_name, 'HEAD') : repo.log
@@ -10,7 +10,9 @@ module GFSM
10
10
 
11
11
  def compute_version!(force, prerelease, prerelease_name, repository_path, configuration_file_path)
12
12
  configuration = GFSM::Data::Configuration.new(configuration_file_path)
13
- changelog_commits = GFSM::Tools::CommitsExtractor.extract_commits_with_changelog_trailer(repository_path)
13
+ changelog_commits = GFSM::Tools::GitUtilities.extract_commits_with_changelog_trailer(
14
+ GFSM::Tools::GitUtilities.load_repo(repository_path)
15
+ )
14
16
 
15
17
  @version = GFSM::Tools::CurrentVersionLoader.load_current_version(repository_path)
16
18
  @subdivisions = GFSM::Tools::CommitsSubdivider.subdivide_commits(configuration, changelog_commits)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gfsm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zille Marco
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-02 00:00:00.000000000 Z
11
+ date: 2022-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yaml
@@ -81,9 +81,9 @@ files:
81
81
  - lib/data/configuration.rb
82
82
  - lib/data/version.rb
83
83
  - lib/gfsm.rb
84
- - lib/tools/commits_extractor.rb
85
84
  - lib/tools/commits_subdivider.rb
86
85
  - lib/tools/current_version_loader.rb
86
+ - lib/tools/git_utilities.rb
87
87
  - lib/tools/output.rb
88
88
  - lib/tools/version_bumper.rb
89
89
  homepage: https://gitlab.com/zillemarco/gitlab-flavored-semantic-versioning