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 +4 -4
- data/lib/makit/directories.rb +56 -26
- data/lib/makit/version.rb +35 -12
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f53268e68239cd1ff7e167f3f466d58acf594cb4cd4b0f1ac8c2dac7bdc102ed
|
|
4
|
+
data.tar.gz: fa63343ea47d2a1aba995fe975299d80112fbd1af3d7f68cc670a3d39736a92c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 533a7a8f644b8e9367f1e9d428cb66e072df4f08373ed87c627c1d42e0543bffad82fb8ee4103a475651895391f1aba014c06657e74a45c92c50cc26d11df871
|
|
7
|
+
data.tar.gz: 4d9c0d9af5d3c7987d0ed969a8b49d2cde25eb2883255900adfeb5de735894d59bab2fcb640aea67dfc2fb52fc5e903ed17dbd8769d92698d9caca11e84e2d6d
|
data/lib/makit/directories.rb
CHANGED
|
@@ -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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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 =
|
|
52
|
+
RAKEDIR = normalize_path(_rakedir_path) # File.dirname(Rake.application.rakefile)
|
|
34
53
|
|
|
35
|
-
|
|
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
|
|
59
|
+
PROJECT_ARTIFACTS = if _project_root_path.nil?
|
|
40
60
|
nil
|
|
41
61
|
else
|
|
42
|
-
File.join(
|
|
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(
|
|
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
|
-
|
|
61
|
-
|
|
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.
|
|
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 =
|
|
250
|
-
new_text =
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
new_text =
|
|
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
|
-
|
|
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,
|
|
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(
|
|
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
|