makit 0.0.156 → 0.0.157

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: 99cc5b06f424c7833c2828dbbd4df8f1cda290cc900aae825f319467cd39d0fc
4
- data.tar.gz: 48ad2c45a2d1b2a9b4ba223c1915ddb6a834b3e826b16e1c430f957edcfca6b9
3
+ metadata.gz: f53268e68239cd1ff7e167f3f466d58acf594cb4cd4b0f1ac8c2dac7bdc102ed
4
+ data.tar.gz: fa63343ea47d2a1aba995fe975299d80112fbd1af3d7f68cc670a3d39736a92c
5
5
  SHA512:
6
- metadata.gz: 9e35a52ee45fd084f4b8e0811a67231cd7c001b56c6d861bad1a7334884b8ba1645b83969cf2b910285a8b61417b1427e6e13aeb07be3b7c6b9944ac9be773f5
7
- data.tar.gz: 4e21ae3c58f2b196a2185fe2b1a94f3b57cb685d8026b0d4e31bd08fa3ac9657326ce82452969fc413f199495e7e9c1780f295c7374368cca511a1f27c9b0701
6
+ metadata.gz: 533a7a8f644b8e9367f1e9d428cb66e072df4f08373ed87c627c1d42e0543bffad82fb8ee4103a475651895391f1aba014c06657e74a45c92c50cc26d11df871
7
+ data.tar.gz: 4d9c0d9af5d3c7987d0ed969a8b49d2cde25eb2883255900adfeb5de735894d59bab2fcb640aea67dfc2fb52fc5e903ed17dbd8769d92698d9caca11e84e2d6d
@@ -12,42 +12,62 @@ module Makit
12
12
  # This class provide methods for working with the system Environment.
13
13
  #
14
14
  module Directories
15
- ROOT = File.join(Dir.home, ".makit")
16
- CLONE = File.join(Dir.home, ".makit", "clone")
17
- MAKE = File.join(Dir.home, ".makit", "make")
18
- LOG = File.join(Dir.home, ".makit", "log")
19
- WORK = File.join(Dir.home, ".makit", "work")
20
- REPOS = File.join(Dir.home, ".makit", "repos")
21
- TEMP = File.join(Dir.home, ".makit", "temp")
22
- INSTALL = File.join(Dir.home, ".makit", "install")
23
- NUGET = File.join(Dir.home, ".makit", "nuget")
24
- HOME = Makit::Directory.normalize(Dir.home)
25
- ONEDRIVE = File.join(Dir.home, "OneDrive")
26
- ONEDRIVE_NUGET_SOURCE = File.join(ONEDRIVE, "code", "artifacts", "nuget")
27
- ONEDRIVE_CONSOLE_SOURCE = File.join(ONEDRIVE, "code", "artifacts", "console")
28
- ONEDRIVE_INSTALLER_SOURCE = File.join(ONEDRIVE, "code", "artifacts", "installer")
29
- CURRENT = Dir.pwd
30
- LOCAL_APPLICATION_DATA = File.join(HOME, "AppData", "Local")
15
+ # Helper method to normalize paths to use backslashes on Windows
16
+ def self.normalize_path(path)
17
+ return nil if path.nil?
18
+ return path if path.empty?
19
+
20
+ if Makit::Environment.is_windows?
21
+ # Convert forward slashes to backslashes on Windows
22
+ path.gsub(/\//, "\\")
23
+ else
24
+ # Keep forward slashes on Unix-like systems
25
+ path
26
+ end
27
+ end
28
+
29
+ # Build paths first, then normalize them to handle dependencies
30
+ _home_path = Makit::Directory.normalize(Dir.home)
31
+ _onedrive_path = File.join(Dir.home, "OneDrive")
32
+ _rakedir_path = Dir.pwd
33
+
34
+ ROOT = normalize_path(File.join(Dir.home, ".makit"))
35
+ CLONE = normalize_path(File.join(Dir.home, ".makit", "clone"))
36
+ MAKE = normalize_path(File.join(Dir.home, ".makit", "make"))
37
+ LOG = normalize_path(File.join(Dir.home, ".makit", "log"))
38
+ WORK = normalize_path(File.join(Dir.home, ".makit", "work"))
39
+ REPOS = normalize_path(File.join(Dir.home, ".makit", "repos"))
40
+ TEMP = normalize_path(File.join(Dir.home, ".makit", "temp"))
41
+ INSTALL = normalize_path(File.join(Dir.home, ".makit", "install"))
42
+ NUGET = normalize_path(File.join(Dir.home, ".makit", "nuget"))
43
+ HOME = normalize_path(_home_path)
44
+ ONEDRIVE = normalize_path(_onedrive_path)
45
+ ONEDRIVE_NUGET_SOURCE = normalize_path(File.join(_onedrive_path, "code", "artifacts", "nuget"))
46
+ ONEDRIVE_CONSOLE_SOURCE = normalize_path(File.join(_onedrive_path, "code", "artifacts", "console"))
47
+ ONEDRIVE_INSTALLER_SOURCE = normalize_path(File.join(_onedrive_path, "code", "artifacts", "installer"))
48
+ CURRENT = normalize_path(Dir.pwd)
49
+ LOCAL_APPLICATION_DATA = normalize_path(File.join(_home_path, "AppData", "Local"))
31
50
  # Rake.application.init
32
51
  # Rake.application.load_rakefile
33
- RAKEDIR = Dir.pwd # File.dirname(Rake.application.rakefile)
52
+ RAKEDIR = normalize_path(_rakedir_path) # File.dirname(Rake.application.rakefile)
34
53
 
35
- PROJECT_ROOT = Makit::Directory.find_directory_with_patterns(RAKEDIR, ["Rakefile", "rakefile.rb", ".gitignore"])
54
+ _project_root_path = Makit::Directory.find_directory_with_patterns(_rakedir_path, ["Rakefile", "rakefile.rb", ".gitignore"])
55
+ PROJECT_ROOT = normalize_path(_project_root_path)
36
56
  # PROJECT_ROOT = Makit::Directory.find_directory_with_pattern(RAKEDIR, "Rakefile")
37
57
  # PROJECT_ROOT = Makit::Directory.find_directory_with_pattern(RAKEDIR, "rakefile.rb")
38
58
  # PROJECT_ROOT = Makit::Directory.find_directory_with_pattern(RAKEDIR, ".gitignore")
39
- PROJECT_ARTIFACTS = if PROJECT_ROOT.nil?
59
+ PROJECT_ARTIFACTS = if _project_root_path.nil?
40
60
  nil
41
61
  else
42
- File.join(PROJECT_ROOT, "artifacts")
62
+ normalize_path(File.join(_project_root_path, "artifacts"))
43
63
  end
44
- LOCAL_NUGET_SOURCE = File.join(Dir.home, ".makit", "nuget")
64
+ LOCAL_NUGET_SOURCE = normalize_path(File.join(Dir.home, ".makit", "nuget"))
45
65
  if Makit::Environment.get_os == "Windows"
46
66
  # NUGET_PACKAGE_CACHE = "#{ENV["USERPROFILE"]}\\.nuget\\packages"
47
- NUGET_PACKAGE_CACHE = File.join(HOME, ".nuget", "packages")
48
- SERVICES = File.join("C:", "Program Files")
67
+ NUGET_PACKAGE_CACHE = normalize_path(File.join(_home_path, ".nuget", "packages"))
68
+ SERVICES = normalize_path(File.join("C:", "Program Files"))
49
69
  else
50
- NUGET_PACKAGE_CACHE = Makit::Directory.normalize("#{Dir.home}/.nuget/packages")
70
+ NUGET_PACKAGE_CACHE = normalize_path(Makit::Directory.normalize("#{Dir.home}/.nuget/packages"))
51
71
  SERVICES = if Makit::Environment.get_os == "macOS"
52
72
  "/Library/LaunchDaemons"
53
73
  else
@@ -56,9 +76,19 @@ module Makit
56
76
  end
57
77
  if Makit::NuGet.get_latest_version("Grpc.Tools").nil?
58
78
  puts " warning: Grpc.Tools not found in Nuget cache"
79
+ GRPC_TOOLS_PATH = nil
80
+ GRPC_CSHARP_PLUGIN_PATH = nil
59
81
  else
60
- GRPC_TOOLS_PATH = File.join(NUGET_PACKAGE_CACHE, "grpc.tools", Makit::Protoc.get_latest_grpc_tools_version)
61
- GRPC_CSHARP_PLUGIN_PATH = Makit::Protoc.find_plugin_path("grpc_csharp_plugin")
82
+ _grpc_tools_version = Makit::Protoc.get_latest_grpc_tools_version
83
+ GRPC_TOOLS_PATH = normalize_path(File.join(NUGET_PACKAGE_CACHE, "grpc.tools", _grpc_tools_version))
84
+ # Now that GRPC_TOOLS_PATH is defined, we can use it in find_plugin_path
85
+ begin
86
+ _grpc_csharp_plugin_path = Makit::Protoc.find_plugin_path("grpc_csharp_plugin")
87
+ GRPC_CSHARP_PLUGIN_PATH = normalize_path(_grpc_csharp_plugin_path)
88
+ rescue => e
89
+ # If plugin path can't be found, set to nil
90
+ GRPC_CSHARP_PLUGIN_PATH = nil
91
+ end
62
92
  end
63
93
 
64
94
  FileUtils.mkdir_p(ROOT)
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.156"
5
+ #VERSION = "0.0.157"
6
6
 
7
7
  # Version management utilities for various file formats
8
8
  #
@@ -246,13 +246,30 @@ module Makit
246
246
  text = File.read(filename)
247
247
  # VERSION = "0.0.138rake" (.rb file)
248
248
  new_text = text
249
- new_text = text.gsub(/VERSION:\s?['|"]([.\d]+)['|"]/, "VERSION: \"#{version}\"") if filename.include?(".yml")
250
- new_text = text.gsub(/version\s?=\s?['|"]([.\d]+)['|"]/, "version='#{version}'") if filename.include?(".gemspec")
251
- new_text = text.gsub(/<Version>([-\w\d.]+)</, "<Version>#{version}<") if filename.include?(".csproj")
252
- new_text = text.gsub(/<version>([-\w\d.]+)</, "<version>#{version}<") if filename.include?(".nuspec")
253
- new_text = text.gsub(/ Version="([\d.]+)"/, " Version=\"#{version}\"") if filename.include?(".wxs")
254
- new_text = text.gsub(/VERSION = "([\d.]+)"/, "VERSION = \"#{version}\"") if filename.include?(".rb")
255
- new_text = text.gsub(/version\s+=\s+['"]([\w.]+)['"]/, "version=\"#{version}\"") if filename.include?(".toml")
249
+ new_text = new_text.gsub(/VERSION:\s?['|"]([.\d]+)['|"]/, "VERSION: \"#{version}\"") if filename.include?(".yml")
250
+ new_text = new_text.gsub(/spec\.version\s*=\s*['"]([^'"]+)['"]/, "spec.version = '#{version}'") if filename.include?(".gemspec")
251
+ # Handle Directory.Build.props and .csproj files (both use <Version> tag)
252
+ if filename.include?("Directory.Build.props") || filename.include?(".csproj")
253
+ new_text = new_text.gsub(/<Version>([-\w\d.]+)</, "<Version>#{version}<")
254
+ end
255
+ new_text = new_text.gsub(/<version>([-\w\d.]+)</, "<version>#{version}<") if filename.include?(".nuspec")
256
+ new_text = new_text.gsub(/ Version="([\d.]+)"/, " Version=\"#{version}\"") if filename.include?(".wxs")
257
+ new_text = new_text.gsub(/VERSION = "([\d.]+)"/, "VERSION = \"#{version}\"") if filename.include?(".rb")
258
+ # Handle Cargo.toml, pyproject.toml, and other .toml files
259
+ if filename.include?(".toml")
260
+ new_text = new_text.gsub(/version\s+=\s+['"]([\w.]+)['"]/, "version=\"#{version}\"")
261
+ end
262
+ # Handle package.json
263
+ if filename.include?("package.json")
264
+ require "json"
265
+ json = JSON.parse(new_text)
266
+ json["version"] = version
267
+ new_text = JSON.pretty_generate(json)
268
+ end
269
+ # Handle pom.xml
270
+ if filename.include?("pom.xml")
271
+ new_text = new_text.gsub(%r{<version>([^<]+)</version>}, "<version>#{version}</version>")
272
+ end
256
273
  File.write(filename, new_text) if new_text != text
257
274
  end
258
275
 
@@ -320,8 +337,11 @@ module Makit
320
337
 
321
338
  raise "Version not found in #{version_file}" if version.nil?
322
339
 
323
- # Display information with relative path
324
- relative_path = version_file.sub(project_root + "/", "")
340
+ # Display information with relative path (Windows-safe path handling)
341
+ # Normalize both paths to forward slashes for comparison, then convert back if needed
342
+ normalized_version_file = version_file.gsub(/\\/, "/")
343
+ normalized_project_root = project_root.gsub(/\\/, "/")
344
+ relative_path = normalized_version_file.sub(normalized_project_root + "/", "")
325
345
  puts " Version File: #{relative_path}"
326
346
  puts " Version: #{version}"
327
347
  end
@@ -392,9 +412,12 @@ module Makit
392
412
  # @param project_root [String] Path to the project root directory
393
413
  # @return [String, nil] Path to the version file, or nil if not found
394
414
  def self.find_ssot_version_file(project_root)
415
+ # Normalize project_root for file operations (Ruby's File methods work with forward slashes)
416
+ normalized_root = project_root.gsub(/\\/, "/")
417
+
395
418
  # Check for manually defined VERSION_FILE constant first
396
419
  if defined?(VERSION_FILE) && !VERSION_FILE.nil?
397
- version_file = File.expand_path(VERSION_FILE, project_root)
420
+ version_file = File.expand_path(VERSION_FILE, normalized_root)
398
421
  return version_file if File.exist?(version_file)
399
422
  warn " Warning: VERSION_FILE constant points to non-existent file: #{VERSION_FILE}"
400
423
  end
@@ -410,7 +433,7 @@ module Makit
410
433
  ]
411
434
 
412
435
  version_file_patterns.each do |pattern|
413
- matches = Dir.glob(File.join(project_root, pattern))
436
+ matches = Dir.glob(File.join(normalized_root, pattern))
414
437
  next if matches.empty?
415
438
 
416
439
  # For gemspec, prefer the one matching the project name or take the first
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.156
4
+ version: 0.0.157
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lou Parslow