makit 0.0.154 → 0.0.156

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: ad406746e87035bfd4254571783e18949321ad6e6c4e3fe773fbaf82cb306320
4
- data.tar.gz: 1bde5d1063f2de07e559ee3faa5a0cd63aad46a94e4b5676b0f08eca68337b49
3
+ metadata.gz: 99cc5b06f424c7833c2828dbbd4df8f1cda290cc900aae825f319467cd39d0fc
4
+ data.tar.gz: 48ad2c45a2d1b2a9b4ba223c1915ddb6a834b3e826b16e1c430f957edcfca6b9
5
5
  SHA512:
6
- metadata.gz: 78967fd3ee402daffaec89af96194fee21d7fbc1c8c327309c6463b300c1880c9ee3a993ca72c07f1652183d436f425277cbb2259018d418d365bd2edee34413
7
- data.tar.gz: '0281c16cdd5f55e125d757c4d5594f3fedc660f49c211b96302da458cf8eae4286d128208eff3a742dd1586e6555e9619bd5b599c55f361f3427ab61adcc6232'
6
+ metadata.gz: 9e35a52ee45fd084f4b8e0811a67231cd7c001b56c6d861bad1a7334884b8ba1645b83969cf2b910285a8b61417b1427e6e13aeb07be3b7c6b9944ac9be773f5
7
+ data.tar.gz: 4e21ae3c58f2b196a2185fe2b1a94f3b57cb685d8026b0d4e31bd08fa3ac9657326ce82452969fc413f199495e7e9c1780f295c7374368cca511a1f27c9b0701
@@ -3,13 +3,24 @@
3
3
  if Dir.exist?(".git")
4
4
  desc "tag the current version"
5
5
  task :tag do
6
- # check if the variable VERSION is defined
7
- unless defined?(VERSION)
8
- puts " VERSION is not defined".colorize(:red)
6
+ # Get version: use VERSION constant if defined, otherwise use Makit::Version.version
7
+ version = if defined?(VERSION) && !VERSION.nil?
8
+ VERSION
9
+ else
10
+ begin
11
+ Makit::Version.version
12
+ rescue => e
13
+ puts " Could not determine version: #{e.message}".colorize(:red)
14
+ return
15
+ end
16
+ end
17
+
18
+ if version.nil? || version.to_s.strip.empty?
19
+ puts " Version is empty or not found".colorize(:red)
9
20
  return
10
21
  end
11
22
 
12
- Makit::Git::CLI.tag(VERSION)
23
+ Makit::Git::CLI.tag(version)
13
24
  end
14
25
  else
15
26
  Makit::Logging.default_logger.debug("Not a git repository, skipping tag")
data/lib/makit/version.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Makit
4
4
  # Static version for now to avoid circular dependency issues
5
- #VERSION = "0.0.154"
5
+ #VERSION = "0.0.156"
6
6
 
7
7
  # Version management utilities for various file formats
8
8
  #
@@ -62,13 +62,14 @@ module Makit
62
62
  #
63
63
  class Version
64
64
 
65
- # Attempt to detect the version from the gemspec file
66
- # First tries to find a gemspec in the current project root
65
+ # Attempt to detect the version from the SSOT (Single Source of Truth) version file
66
+ # Uses the same logic as Makit::Version.info to find version files in priority order:
67
+ # *.gemspec, Directory.Build.props, Cargo.toml, package.json, pyproject.toml, pom.xml
67
68
  # Falls back to makit.gemspec only if we're in the makit gem directory
68
- # @return [String] The version string, or "0.0.0" if no gemspec is found
69
- # @raise [RuntimeError] If a gemspec is found but version cannot be detected
69
+ # @return [String] The version string, or "0.0.0" if no version file is found
70
+ # @raise [RuntimeError] If a version file is found but version cannot be detected
70
71
  def self.version
71
- # Try to find gemspec in project root first (for projects using makit)
72
+ # Try to find version file in project root using SSOT logic (same as Makit::Version.info)
72
73
  project_root = begin
73
74
  require_relative "directories" unless defined?(Makit::Directories)
74
75
  Makit::Directories::PROJECT_ROOT
@@ -76,14 +77,12 @@ module Makit
76
77
  find_project_root(Dir.pwd)
77
78
  end
78
79
 
79
- # Look for any .gemspec file in project root
80
+ # Use SSOT version file detection (supports multiple file types)
80
81
  if project_root && Dir.exist?(project_root)
81
- gemspec_files = Dir.glob(File.join(project_root, "*.gemspec"))
82
- if gemspec_files.any?
83
- gemspec = gemspec_files.first
84
- gemspec_content = File.read(gemspec)
85
- match = gemspec_content.match(/spec\.version\s*=\s*["']([^"']+)["']/)
86
- return match[1] if match
82
+ version_file = find_ssot_version_file(project_root)
83
+ if version_file && File.exist?(version_file)
84
+ version = extract_version_from_ssot_file(version_file)
85
+ return version if version
87
86
  end
88
87
  end
89
88
 
@@ -115,7 +114,7 @@ module Makit
115
114
  end
116
115
  end
117
116
 
118
- # If no gemspec found, return default version (for non-gem projects)
117
+ # If no version file found, return default version (for non-gem projects)
119
118
  "0.0.0"
120
119
  end
121
120
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: makit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.154
4
+ version: 0.0.156
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lou Parslow