makit 0.0.140 → 0.0.141
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/README.md +41 -41
- data/exe/makit +5 -5
- data/lib/makit/apache.rb +28 -28
- data/lib/makit/auto.rb +48 -48
- data/lib/makit/cli/build_commands.rb +500 -500
- data/lib/makit/cli/generators/base_generator.rb +74 -74
- data/lib/makit/cli/generators/dotnet_generator.rb +50 -50
- data/lib/makit/cli/generators/generator_factory.rb +49 -49
- data/lib/makit/cli/generators/node_generator.rb +50 -50
- data/lib/makit/cli/generators/ruby_generator.rb +77 -77
- data/lib/makit/cli/generators/rust_generator.rb +50 -50
- data/lib/makit/cli/generators/templates/dotnet_templates.rb +167 -167
- data/lib/makit/cli/generators/templates/node_templates.rb +161 -161
- data/lib/makit/cli/generators/templates/ruby/gemfile.rb +26 -26
- data/lib/makit/cli/generators/templates/ruby/gemspec.rb +40 -40
- data/lib/makit/cli/generators/templates/ruby/main_lib.rb +33 -33
- data/lib/makit/cli/generators/templates/ruby/rakefile.rb +35 -35
- data/lib/makit/cli/generators/templates/ruby/readme.rb +63 -63
- data/lib/makit/cli/generators/templates/ruby/test.rb +39 -39
- data/lib/makit/cli/generators/templates/ruby/test_helper.rb +29 -29
- data/lib/makit/cli/generators/templates/ruby/version.rb +29 -29
- data/lib/makit/cli/generators/templates/rust_templates.rb +128 -128
- data/lib/makit/cli/main.rb +69 -69
- data/lib/makit/cli/project_commands.rb +868 -868
- data/lib/makit/cli/repository_commands.rb +661 -661
- data/lib/makit/cli/strategy_commands.rb +203 -203
- data/lib/makit/cli/utility_commands.rb +521 -521
- data/lib/makit/commands/factory.rb +359 -359
- data/lib/makit/commands/middleware/base.rb +73 -73
- data/lib/makit/commands/middleware/cache.rb +248 -248
- data/lib/makit/commands/middleware/command_logger.rb +312 -312
- data/lib/makit/commands/middleware/validator.rb +269 -269
- data/lib/makit/commands/request.rb +316 -316
- data/lib/makit/commands/result.rb +323 -323
- data/lib/makit/commands/runner.rb +388 -385
- data/lib/makit/commands/strategies/base.rb +171 -171
- data/lib/makit/commands/strategies/child_process.rb +165 -165
- data/lib/makit/commands/strategies/factory.rb +136 -136
- data/lib/makit/commands/strategies/synchronous.rb +139 -139
- data/lib/makit/commands.rb +50 -50
- data/lib/makit/configuration/dotnet_project.rb +12 -12
- data/lib/makit/configuration/gitlab_helper.rb +58 -58
- data/lib/makit/configuration/project.rb +168 -168
- data/lib/makit/configuration/rakefile_helper.rb +43 -43
- data/lib/makit/configuration/step.rb +34 -34
- data/lib/makit/configuration/timeout.rb +74 -74
- data/lib/makit/configuration.rb +15 -15
- data/lib/makit/content/default_gitignore.rb +7 -7
- data/lib/makit/content/default_gitignore.txt +225 -225
- data/lib/makit/content/default_rakefile.rb +13 -13
- data/lib/makit/content/gem_rakefile.rb +16 -16
- data/lib/makit/context.rb +1 -1
- data/lib/makit/data.rb +49 -49
- data/lib/makit/directories.rb +140 -140
- data/lib/makit/directory.rb +262 -262
- data/lib/makit/docs/files.rb +89 -89
- data/lib/makit/docs/rake.rb +102 -102
- data/lib/makit/dotnet/cli.rb +69 -69
- data/lib/makit/dotnet/project.rb +217 -217
- data/lib/makit/dotnet/solution.rb +38 -38
- data/lib/makit/dotnet/solution_classlib.rb +239 -239
- data/lib/makit/dotnet/solution_console.rb +264 -264
- data/lib/makit/dotnet/solution_maui.rb +354 -354
- data/lib/makit/dotnet/solution_wasm.rb +275 -275
- data/lib/makit/dotnet/solution_wpf.rb +304 -304
- data/lib/makit/dotnet.rb +102 -102
- data/lib/makit/email.rb +90 -90
- data/lib/makit/environment.rb +142 -142
- data/lib/makit/examples/runner.rb +370 -370
- data/lib/makit/exceptions.rb +45 -45
- data/lib/makit/fileinfo.rb +24 -24
- data/lib/makit/files.rb +43 -43
- data/lib/makit/gems.rb +40 -40
- data/lib/makit/git/cli.rb +54 -54
- data/lib/makit/git/repository.rb +90 -90
- data/lib/makit/git.rb +98 -98
- data/lib/makit/gitlab_runner.rb +59 -59
- data/lib/makit/humanize.rb +137 -137
- data/lib/makit/indexer.rb +47 -47
- data/lib/makit/logging/configuration.rb +308 -308
- data/lib/makit/logging/format_registry.rb +84 -84
- data/lib/makit/logging/formatters/base.rb +39 -39
- data/lib/makit/logging/formatters/console_formatter.rb +140 -140
- data/lib/makit/logging/formatters/json_formatter.rb +65 -65
- data/lib/makit/logging/formatters/plain_text_formatter.rb +71 -71
- data/lib/makit/logging/formatters/text_formatter.rb +64 -64
- data/lib/makit/logging/log_request.rb +119 -119
- data/lib/makit/logging/logger.rb +199 -199
- data/lib/makit/logging/sinks/base.rb +91 -91
- data/lib/makit/logging/sinks/console.rb +72 -72
- data/lib/makit/logging/sinks/file_sink.rb +92 -92
- data/lib/makit/logging/sinks/structured.rb +123 -123
- data/lib/makit/logging/sinks/unified_file_sink.rb +296 -296
- data/lib/makit/logging.rb +565 -565
- data/lib/makit/markdown.rb +75 -75
- data/lib/makit/mp/basic_object_mp.rb +17 -17
- data/lib/makit/mp/command_mp.rb +13 -13
- data/lib/makit/mp/command_request.mp.rb +17 -17
- data/lib/makit/mp/project_mp.rb +199 -199
- data/lib/makit/mp/string_mp.rb +199 -191
- data/lib/makit/nuget.rb +74 -74
- data/lib/makit/port.rb +32 -32
- data/lib/makit/process.rb +163 -163
- data/lib/makit/protoc.rb +107 -107
- data/lib/makit/rake/cli.rb +196 -196
- data/lib/makit/rake/trace_controller.rb +173 -173
- data/lib/makit/rake.rb +80 -80
- data/lib/makit/ruby/cli.rb +185 -185
- data/lib/makit/ruby.rb +25 -25
- data/lib/makit/secrets.rb +51 -51
- data/lib/makit/serializer.rb +130 -130
- data/lib/makit/services/builder.rb +186 -186
- data/lib/makit/services/error_handler.rb +226 -226
- data/lib/makit/services/repository_manager.rb +231 -231
- data/lib/makit/services/validator.rb +112 -112
- data/lib/makit/setup/classlib.rb +101 -101
- data/lib/makit/setup/gem.rb +268 -268
- data/lib/makit/setup/razorclasslib.rb +101 -101
- data/lib/makit/setup/runner.rb +54 -54
- data/lib/makit/setup.rb +5 -5
- data/lib/makit/show.rb +110 -110
- data/lib/makit/storage.rb +126 -126
- data/lib/makit/symbols.rb +170 -170
- data/lib/makit/task_info.rb +130 -130
- data/lib/makit/tasks/at_exit.rb +15 -15
- data/lib/makit/tasks/build.rb +22 -22
- data/lib/makit/tasks/clean.rb +13 -13
- data/lib/makit/tasks/configure.rb +10 -10
- data/lib/makit/tasks/format.rb +10 -10
- data/lib/makit/tasks/hook_manager.rb +443 -443
- data/lib/makit/tasks/init.rb +49 -49
- data/lib/makit/tasks/integrate.rb +29 -29
- data/lib/makit/tasks/pull_incoming.rb +13 -13
- data/lib/makit/tasks/setup.rb +13 -13
- data/lib/makit/tasks/sync.rb +17 -17
- data/lib/makit/tasks/tag.rb +16 -16
- data/lib/makit/tasks/task_monkey_patch.rb +81 -81
- data/lib/makit/tasks/test.rb +22 -22
- data/lib/makit/tasks/update.rb +18 -18
- data/lib/makit/tasks.rb +20 -20
- data/lib/makit/test_cache.rb +239 -239
- data/lib/makit/tree.rb +37 -37
- data/lib/makit/v1/makit.v1_pb.rb +35 -35
- data/lib/makit/v1/makit.v1_services_pb.rb +27 -27
- data/lib/makit/version.rb +99 -99
- data/lib/makit/version_util.rb +21 -21
- data/lib/makit/wix.rb +95 -95
- data/lib/makit/yaml.rb +29 -29
- data/lib/makit/zip.rb +17 -17
- data/lib/makit copy.rb +44 -44
- data/lib/makit.rb +42 -42
- metadata +2 -2
@@ -1,27 +1,27 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
4
|
-
# Source: lib/makit/v1/makit.v1.proto for package 'makit.v1'
|
5
|
-
|
6
|
-
require "grpc"
|
7
|
-
require_relative "makit.v1_pb"
|
8
|
-
|
9
|
-
module Makit
|
10
|
-
module V1
|
11
|
-
module CommandService
|
12
|
-
# Service to execute commands on devices.
|
13
|
-
class Service
|
14
|
-
include ::GRPC::GenericService
|
15
|
-
|
16
|
-
self.marshal_class_method = :encode
|
17
|
-
self.unmarshal_class_method = :decode
|
18
|
-
self.service_name = "makit.v1.CommandService"
|
19
|
-
|
20
|
-
# Execute a command on a device.
|
21
|
-
rpc :Execute, ::Makit::V1::CommandRequest, ::Makit::V1::Command
|
22
|
-
end
|
23
|
-
|
24
|
-
Stub = Service.rpc_stub_class
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
4
|
+
# Source: lib/makit/v1/makit.v1.proto for package 'makit.v1'
|
5
|
+
|
6
|
+
require "grpc"
|
7
|
+
require_relative "makit.v1_pb"
|
8
|
+
|
9
|
+
module Makit
|
10
|
+
module V1
|
11
|
+
module CommandService
|
12
|
+
# Service to execute commands on devices.
|
13
|
+
class Service
|
14
|
+
include ::GRPC::GenericService
|
15
|
+
|
16
|
+
self.marshal_class_method = :encode
|
17
|
+
self.unmarshal_class_method = :decode
|
18
|
+
self.service_name = "makit.v1.CommandService"
|
19
|
+
|
20
|
+
# Execute a command on a device.
|
21
|
+
rpc :Execute, ::Makit::V1::CommandRequest, ::Makit::V1::Command
|
22
|
+
end
|
23
|
+
|
24
|
+
Stub = Service.rpc_stub_class
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/makit/version.rb
CHANGED
@@ -1,100 +1,100 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Makit
|
4
|
-
# Static version for now to avoid circular dependency issues
|
5
|
-
VERSION = "0.0.
|
6
|
-
|
7
|
-
# Version management utilities for various file formats
|
8
|
-
#
|
9
|
-
# This class provides methods for detecting, extracting, and updating version
|
10
|
-
# numbers in various file formats including .csproj, .wxs, .yml, .gemspec,
|
11
|
-
# .nuspec, and .toml files.
|
12
|
-
class Version
|
13
|
-
# Find the highest version from an array of version strings
|
14
|
-
#
|
15
|
-
# @param versions [Array<String>] Array of version strings to compare
|
16
|
-
# @return [String] The highest version string using semantic versioning comparison
|
17
|
-
def self.get_highest_version(versions)
|
18
|
-
versions.max { |a, b| Gem::Version.new(a) <=> Gem::Version.new(b) }
|
19
|
-
end
|
20
|
-
|
21
|
-
# Extract version number from a file based on its extension
|
22
|
-
#
|
23
|
-
# Supports multiple file formats:
|
24
|
-
# - .csproj files: `<Version>x.y.z</Version>`
|
25
|
-
# - .wxs files: `Version="x.y.z"`
|
26
|
-
# - .yml files: `VERSION: "x.y.z"`
|
27
|
-
#
|
28
|
-
# @param path [String] Path to the file containing version information
|
29
|
-
# @return [String] The extracted version string
|
30
|
-
# @raise [RuntimeError] If file doesn't exist or has unrecognized extension
|
31
|
-
def self.get_version_from_file(path)
|
32
|
-
raise "file #{path}does not exist" unless File.exist?(path)
|
33
|
-
|
34
|
-
extension = File.extname(path)
|
35
|
-
case extension
|
36
|
-
when ".csproj"
|
37
|
-
Makit::Version.detect_from_file(path, /<Version>([-\w\d.]+)</)
|
38
|
-
when ".wxs"
|
39
|
-
Makit::Version.detect_from_file(path, / Version="([\d.]+)"/)
|
40
|
-
when ".yml"
|
41
|
-
Makit::Version.detect_from_file(path, /VERSION:\s*["']?([\d.]+)["']?/)
|
42
|
-
when ".rb"
|
43
|
-
Makit::Version.detect_from_file(path, /VERSION = "([\d.]+)"/)
|
44
|
-
else
|
45
|
-
raise "unrecognized file type"
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
# Detect version using a regex pattern in a specific file
|
50
|
-
#
|
51
|
-
# @param filename [String] Path to the file to search
|
52
|
-
# @param regex [Regexp] Regular expression pattern to match version
|
53
|
-
# @return [String, nil] The extracted version or nil if no match found
|
54
|
-
# @raise [RuntimeError] If file doesn't exist
|
55
|
-
def self.detect_from_file(filename, regex)
|
56
|
-
raise "unable to find version in #{filename}" unless File.exist?(filename)
|
57
|
-
|
58
|
-
match = File.read(filename).match(regex)
|
59
|
-
match.captures[0] if !match.nil? && match.captures.length.positive?
|
60
|
-
end
|
61
|
-
|
62
|
-
# Update version number in a file based on its extension
|
63
|
-
#
|
64
|
-
# Supports updating versions in multiple file formats:
|
65
|
-
# - .yml files
|
66
|
-
# - .gemspec files
|
67
|
-
# - .csproj files
|
68
|
-
# - .nuspec files
|
69
|
-
# - .wxs files
|
70
|
-
# - .toml files
|
71
|
-
#
|
72
|
-
# @param filename [String] Path to the file to update
|
73
|
-
# @param version [String] New version string to set
|
74
|
-
# @return [nil]
|
75
|
-
def self.set_version_in_file(filename, version)
|
76
|
-
text = File.read(filename)
|
77
|
-
# VERSION = "0.0.138rake" (.rb file)
|
78
|
-
new_text = text
|
79
|
-
new_text = text.gsub(/VERSION:\s?['|"]([.\d]+)['|"]/, "VERSION: \"#{version}\"") if filename.include?(".yml")
|
80
|
-
new_text = text.gsub(/version\s?=\s?['|"]([.\d]+)['|"]/, "version='#{version}'") if filename.include?(".gemspec")
|
81
|
-
new_text = text.gsub(/<Version>([-\w\d.]+)</, "<Version>#{version}<") if filename.include?(".csproj")
|
82
|
-
new_text = text.gsub(/<version>([-\w\d.]+)</, "<version>#{version}<") if filename.include?(".nuspec")
|
83
|
-
new_text = text.gsub(/ Version="([\d.]+)"/, " Version=\"#{version}\"") if filename.include?(".wxs")
|
84
|
-
new_text = text.gsub(/VERSION = "([\d.]+)"/, "VERSION = \"#{version}\"") if filename.include?(".rb")
|
85
|
-
new_text = text.gsub(/version\s+=\s+['"]([\w.]+)['"]/, "version=\"#{version}\"") if filename.include?(".toml")
|
86
|
-
File.write(filename, new_text) if new_text != text
|
87
|
-
end
|
88
|
-
|
89
|
-
# Update version number in multiple files matching a glob pattern
|
90
|
-
#
|
91
|
-
# @param glob_pattern [String] Glob pattern to match files (e.g., '**/*.csproj')
|
92
|
-
# @param version [String] New version string to set in all matching files
|
93
|
-
# @return [nil]
|
94
|
-
def self.set_version_in_files(glob_pattern, version)
|
95
|
-
Dir.glob(glob_pattern).each do |filename|
|
96
|
-
set_version_in_file(filename, version)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Makit
|
4
|
+
# Static version for now to avoid circular dependency issues
|
5
|
+
VERSION = "0.0.141"
|
6
|
+
|
7
|
+
# Version management utilities for various file formats
|
8
|
+
#
|
9
|
+
# This class provides methods for detecting, extracting, and updating version
|
10
|
+
# numbers in various file formats including .csproj, .wxs, .yml, .gemspec,
|
11
|
+
# .nuspec, and .toml files.
|
12
|
+
class Version
|
13
|
+
# Find the highest version from an array of version strings
|
14
|
+
#
|
15
|
+
# @param versions [Array<String>] Array of version strings to compare
|
16
|
+
# @return [String] The highest version string using semantic versioning comparison
|
17
|
+
def self.get_highest_version(versions)
|
18
|
+
versions.max { |a, b| Gem::Version.new(a) <=> Gem::Version.new(b) }
|
19
|
+
end
|
20
|
+
|
21
|
+
# Extract version number from a file based on its extension
|
22
|
+
#
|
23
|
+
# Supports multiple file formats:
|
24
|
+
# - .csproj files: `<Version>x.y.z</Version>`
|
25
|
+
# - .wxs files: `Version="x.y.z"`
|
26
|
+
# - .yml files: `VERSION: "x.y.z"`
|
27
|
+
#
|
28
|
+
# @param path [String] Path to the file containing version information
|
29
|
+
# @return [String] The extracted version string
|
30
|
+
# @raise [RuntimeError] If file doesn't exist or has unrecognized extension
|
31
|
+
def self.get_version_from_file(path)
|
32
|
+
raise "file #{path}does not exist" unless File.exist?(path)
|
33
|
+
|
34
|
+
extension = File.extname(path)
|
35
|
+
case extension
|
36
|
+
when ".csproj"
|
37
|
+
Makit::Version.detect_from_file(path, /<Version>([-\w\d.]+)</)
|
38
|
+
when ".wxs"
|
39
|
+
Makit::Version.detect_from_file(path, / Version="([\d.]+)"/)
|
40
|
+
when ".yml"
|
41
|
+
Makit::Version.detect_from_file(path, /VERSION:\s*["']?([\d.]+)["']?/)
|
42
|
+
when ".rb"
|
43
|
+
Makit::Version.detect_from_file(path, /VERSION = "([\d.]+)"/)
|
44
|
+
else
|
45
|
+
raise "unrecognized file type"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# Detect version using a regex pattern in a specific file
|
50
|
+
#
|
51
|
+
# @param filename [String] Path to the file to search
|
52
|
+
# @param regex [Regexp] Regular expression pattern to match version
|
53
|
+
# @return [String, nil] The extracted version or nil if no match found
|
54
|
+
# @raise [RuntimeError] If file doesn't exist
|
55
|
+
def self.detect_from_file(filename, regex)
|
56
|
+
raise "unable to find version in #{filename}" unless File.exist?(filename)
|
57
|
+
|
58
|
+
match = File.read(filename).match(regex)
|
59
|
+
match.captures[0] if !match.nil? && match.captures.length.positive?
|
60
|
+
end
|
61
|
+
|
62
|
+
# Update version number in a file based on its extension
|
63
|
+
#
|
64
|
+
# Supports updating versions in multiple file formats:
|
65
|
+
# - .yml files
|
66
|
+
# - .gemspec files
|
67
|
+
# - .csproj files
|
68
|
+
# - .nuspec files
|
69
|
+
# - .wxs files
|
70
|
+
# - .toml files
|
71
|
+
#
|
72
|
+
# @param filename [String] Path to the file to update
|
73
|
+
# @param version [String] New version string to set
|
74
|
+
# @return [nil]
|
75
|
+
def self.set_version_in_file(filename, version)
|
76
|
+
text = File.read(filename)
|
77
|
+
# VERSION = "0.0.138rake" (.rb file)
|
78
|
+
new_text = text
|
79
|
+
new_text = text.gsub(/VERSION:\s?['|"]([.\d]+)['|"]/, "VERSION: \"#{version}\"") if filename.include?(".yml")
|
80
|
+
new_text = text.gsub(/version\s?=\s?['|"]([.\d]+)['|"]/, "version='#{version}'") if filename.include?(".gemspec")
|
81
|
+
new_text = text.gsub(/<Version>([-\w\d.]+)</, "<Version>#{version}<") if filename.include?(".csproj")
|
82
|
+
new_text = text.gsub(/<version>([-\w\d.]+)</, "<version>#{version}<") if filename.include?(".nuspec")
|
83
|
+
new_text = text.gsub(/ Version="([\d.]+)"/, " Version=\"#{version}\"") if filename.include?(".wxs")
|
84
|
+
new_text = text.gsub(/VERSION = "([\d.]+)"/, "VERSION = \"#{version}\"") if filename.include?(".rb")
|
85
|
+
new_text = text.gsub(/version\s+=\s+['"]([\w.]+)['"]/, "version=\"#{version}\"") if filename.include?(".toml")
|
86
|
+
File.write(filename, new_text) if new_text != text
|
87
|
+
end
|
88
|
+
|
89
|
+
# Update version number in multiple files matching a glob pattern
|
90
|
+
#
|
91
|
+
# @param glob_pattern [String] Glob pattern to match files (e.g., '**/*.csproj')
|
92
|
+
# @param version [String] New version string to set in all matching files
|
93
|
+
# @return [nil]
|
94
|
+
def self.set_version_in_files(glob_pattern, version)
|
95
|
+
Dir.glob(glob_pattern).each do |filename|
|
96
|
+
set_version_in_file(filename, version)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
100
|
end
|
data/lib/makit/version_util.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Makit
|
4
|
-
# Version utility class for handling version comparisons
|
5
|
-
class Version
|
6
|
-
# Get the highest version from a list of version strings
|
7
|
-
#
|
8
|
-
# @param versions [Array<String>] array of version strings
|
9
|
-
# @return [String, nil] highest version string or nil if empty
|
10
|
-
def self.get_highest_version(versions)
|
11
|
-
return nil if versions.nil? || versions.empty?
|
12
|
-
|
13
|
-
# Sort versions using Gem::Version for proper semantic versioning
|
14
|
-
sorted_versions = versions.sort_by { |v| Gem::Version.new(v) }
|
15
|
-
sorted_versions.last
|
16
|
-
rescue ArgumentError
|
17
|
-
# If any version is invalid, fall back to string sorting
|
18
|
-
versions.max
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Makit
|
4
|
+
# Version utility class for handling version comparisons
|
5
|
+
class Version
|
6
|
+
# Get the highest version from a list of version strings
|
7
|
+
#
|
8
|
+
# @param versions [Array<String>] array of version strings
|
9
|
+
# @return [String, nil] highest version string or nil if empty
|
10
|
+
def self.get_highest_version(versions)
|
11
|
+
return nil if versions.nil? || versions.empty?
|
12
|
+
|
13
|
+
# Sort versions using Gem::Version for proper semantic versioning
|
14
|
+
sorted_versions = versions.sort_by { |v| Gem::Version.new(v) }
|
15
|
+
sorted_versions.last
|
16
|
+
rescue ArgumentError
|
17
|
+
# If any version is invalid, fall back to string sorting
|
18
|
+
versions.max
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/makit/wix.rb
CHANGED
@@ -1,95 +1,95 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "securerandom"
|
4
|
-
|
5
|
-
module Makit
|
6
|
-
# This class provide methods for working with the Nuget package cache
|
7
|
-
#
|
8
|
-
# Example:
|
9
|
-
#
|
10
|
-
# Makit::Directory.cache("Google.Protobuf", "3.27.2")
|
11
|
-
#
|
12
|
-
# dotnet nuget locals all --list
|
13
|
-
# dotnet nuget locals all --clear
|
14
|
-
#
|
15
|
-
class Wix
|
16
|
-
def self.setup
|
17
|
-
if Makit::Environment.is_windows?
|
18
|
-
# test if dotnet is installed
|
19
|
-
if Makit::DotNet.is_installed?
|
20
|
-
# test if wix is already installed
|
21
|
-
"dotnet tool install --global wix".run unless `dotnet tool list --global`.include?("wix")
|
22
|
-
puts " Wix version #{Wix.version.to_s.colorize(:green)}"
|
23
|
-
# display the link to https://wixtoolset.org/
|
24
|
-
puts " https://wixtoolset.org/".colorize(:green)
|
25
|
-
# display the link to https://marketplace.visualstudio.com/items?itemName=FireGiant.FireGiantHeatWaveDev17
|
26
|
-
puts " https://marketplace.visualstudio.com/items?itemName=FireGiant.FireGiantHeatWaveDev17".colorize(:green)
|
27
|
-
else # !File.exist?(Makit::Environment.which("dotnet"))
|
28
|
-
puts "dotnet does not appear to be installed"
|
29
|
-
end
|
30
|
-
else
|
31
|
-
puts "Wix is not supported on non-Windows platforms"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.version
|
36
|
-
`wix --version`.strip.split("+").first
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.setup_package(name, path, files)
|
40
|
-
# create the path if it does not exist
|
41
|
-
FileUtils.mkdir_p(path) unless File.directory?(path)
|
42
|
-
# create the #{name}.wixproj file
|
43
|
-
File.open("#{path}/#{name}.wixproj", "w") do |f|
|
44
|
-
f.puts "<Project Sdk=\"WixToolset.Sdk/#{Wix.version}\">"
|
45
|
-
f.puts "</Project>"
|
46
|
-
end
|
47
|
-
# create the Package.wxs file
|
48
|
-
File.open("#{path}/Package.wxs", "w") do |f|
|
49
|
-
f.puts "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">"
|
50
|
-
f.puts " <Package Name=\"#{name}\" Manufacturer=\"Acme\" Version=\"0.0.0.0\" UpgradeCode=\"#{SecureRandom.uuid}\">"
|
51
|
-
# f.puts " <MajorUpgrade DowngradeErrorMessage=\"!(loc.DowngradeError)\" />"
|
52
|
-
f.puts " <Files Include=\"#{files}\" />"
|
53
|
-
# f.puts " <Feature Id=\"Main\">"
|
54
|
-
# f.puts " <ComponentGroupRef Id=\"Components\" />"
|
55
|
-
# f.puts " </Feature>"
|
56
|
-
f.puts " </Package>"
|
57
|
-
f.puts "</Wix>"
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
# Package.wxs with File harvesting
|
64
|
-
# <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
65
|
-
# <Package Name="MyProduct" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="B0B15C00-1DC4-0374-A1D1-E902240936D5">
|
66
|
-
# <Files Include="path\to\files\**" />
|
67
|
-
# </Package>
|
68
|
-
# </Wix>
|
69
|
-
|
70
|
-
# <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
71
|
-
# <Package Name="Msi.Demo" Manufacturer="Acme" Version="1.0.0.0" UpgradeCode="a87571ec-8be3-447e-ae23-b3a94a85b727">
|
72
|
-
# <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
|
73
|
-
|
74
|
-
# <Feature Id="Main">
|
75
|
-
# <ComponentGroupRef Id="Components" />
|
76
|
-
# </Feature>
|
77
|
-
# </Package>
|
78
|
-
# </Wix>
|
79
|
-
|
80
|
-
# <Project Sdk="WixToolset.Sdk/5.0.1">
|
81
|
-
# </Project>
|
82
|
-
|
83
|
-
# Components.wxs
|
84
|
-
# <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
85
|
-
# <Fragment>
|
86
|
-
# <ComponentGroup Id="Components" Directory="INSTALLFOLDER">
|
87
|
-
# <Component Guid="b8085fb3-3718-46df-8bf6-ecf9f968dd3d">
|
88
|
-
# <File Source="../../artifacts/Msi.Demo.exe" />
|
89
|
-
# <File Source="../../artifacts/Msi.Demo.dll" />
|
90
|
-
# <File Source="../../artifacts/Msi.Demo.deps.json" />
|
91
|
-
# <File Source="../../artifacts/Msi.Demo.runtimeconfig.json" />
|
92
|
-
# </Component>
|
93
|
-
# </ComponentGroup>
|
94
|
-
# </Fragment>
|
95
|
-
# </Wix>
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "securerandom"
|
4
|
+
|
5
|
+
module Makit
|
6
|
+
# This class provide methods for working with the Nuget package cache
|
7
|
+
#
|
8
|
+
# Example:
|
9
|
+
#
|
10
|
+
# Makit::Directory.cache("Google.Protobuf", "3.27.2")
|
11
|
+
#
|
12
|
+
# dotnet nuget locals all --list
|
13
|
+
# dotnet nuget locals all --clear
|
14
|
+
#
|
15
|
+
class Wix
|
16
|
+
def self.setup
|
17
|
+
if Makit::Environment.is_windows?
|
18
|
+
# test if dotnet is installed
|
19
|
+
if Makit::DotNet.is_installed?
|
20
|
+
# test if wix is already installed
|
21
|
+
"dotnet tool install --global wix".run unless `dotnet tool list --global`.include?("wix")
|
22
|
+
puts " Wix version #{Wix.version.to_s.colorize(:green)}"
|
23
|
+
# display the link to https://wixtoolset.org/
|
24
|
+
puts " https://wixtoolset.org/".colorize(:green)
|
25
|
+
# display the link to https://marketplace.visualstudio.com/items?itemName=FireGiant.FireGiantHeatWaveDev17
|
26
|
+
puts " https://marketplace.visualstudio.com/items?itemName=FireGiant.FireGiantHeatWaveDev17".colorize(:green)
|
27
|
+
else # !File.exist?(Makit::Environment.which("dotnet"))
|
28
|
+
puts "dotnet does not appear to be installed"
|
29
|
+
end
|
30
|
+
else
|
31
|
+
puts "Wix is not supported on non-Windows platforms"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.version
|
36
|
+
`wix --version`.strip.split("+").first
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.setup_package(name, path, files)
|
40
|
+
# create the path if it does not exist
|
41
|
+
FileUtils.mkdir_p(path) unless File.directory?(path)
|
42
|
+
# create the #{name}.wixproj file
|
43
|
+
File.open("#{path}/#{name}.wixproj", "w") do |f|
|
44
|
+
f.puts "<Project Sdk=\"WixToolset.Sdk/#{Wix.version}\">"
|
45
|
+
f.puts "</Project>"
|
46
|
+
end
|
47
|
+
# create the Package.wxs file
|
48
|
+
File.open("#{path}/Package.wxs", "w") do |f|
|
49
|
+
f.puts "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">"
|
50
|
+
f.puts " <Package Name=\"#{name}\" Manufacturer=\"Acme\" Version=\"0.0.0.0\" UpgradeCode=\"#{SecureRandom.uuid}\">"
|
51
|
+
# f.puts " <MajorUpgrade DowngradeErrorMessage=\"!(loc.DowngradeError)\" />"
|
52
|
+
f.puts " <Files Include=\"#{files}\" />"
|
53
|
+
# f.puts " <Feature Id=\"Main\">"
|
54
|
+
# f.puts " <ComponentGroupRef Id=\"Components\" />"
|
55
|
+
# f.puts " </Feature>"
|
56
|
+
f.puts " </Package>"
|
57
|
+
f.puts "</Wix>"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# Package.wxs with File harvesting
|
64
|
+
# <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
65
|
+
# <Package Name="MyProduct" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="B0B15C00-1DC4-0374-A1D1-E902240936D5">
|
66
|
+
# <Files Include="path\to\files\**" />
|
67
|
+
# </Package>
|
68
|
+
# </Wix>
|
69
|
+
|
70
|
+
# <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
71
|
+
# <Package Name="Msi.Demo" Manufacturer="Acme" Version="1.0.0.0" UpgradeCode="a87571ec-8be3-447e-ae23-b3a94a85b727">
|
72
|
+
# <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
|
73
|
+
|
74
|
+
# <Feature Id="Main">
|
75
|
+
# <ComponentGroupRef Id="Components" />
|
76
|
+
# </Feature>
|
77
|
+
# </Package>
|
78
|
+
# </Wix>
|
79
|
+
|
80
|
+
# <Project Sdk="WixToolset.Sdk/5.0.1">
|
81
|
+
# </Project>
|
82
|
+
|
83
|
+
# Components.wxs
|
84
|
+
# <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
85
|
+
# <Fragment>
|
86
|
+
# <ComponentGroup Id="Components" Directory="INSTALLFOLDER">
|
87
|
+
# <Component Guid="b8085fb3-3718-46df-8bf6-ecf9f968dd3d">
|
88
|
+
# <File Source="../../artifacts/Msi.Demo.exe" />
|
89
|
+
# <File Source="../../artifacts/Msi.Demo.dll" />
|
90
|
+
# <File Source="../../artifacts/Msi.Demo.deps.json" />
|
91
|
+
# <File Source="../../artifacts/Msi.Demo.runtimeconfig.json" />
|
92
|
+
# </Component>
|
93
|
+
# </ComponentGroup>
|
94
|
+
# </Fragment>
|
95
|
+
# </Wix>
|
data/lib/makit/yaml.rb
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "yaml"
|
4
|
-
|
5
|
-
# frozen_string_literal: true
|
6
|
-
|
7
|
-
# This module provides classes for the Makit gem.
|
8
|
-
module Makit
|
9
|
-
# YAML file validation utilities
|
10
|
-
#
|
11
|
-
# This class provides methods for validating YAML file syntax
|
12
|
-
# and structure, helping to catch configuration errors early.
|
13
|
-
class Yaml
|
14
|
-
# Validate YAML file syntax and structure
|
15
|
-
#
|
16
|
-
# Attempts to parse a YAML file to verify it has valid syntax.
|
17
|
-
# Prints a success message if valid, raises an error if invalid.
|
18
|
-
#
|
19
|
-
# @param file_path [String] Path to the YAML file to validate
|
20
|
-
# @return [nil] Prints success message if validation passes
|
21
|
-
# @raise [RuntimeError] If YAML syntax is invalid
|
22
|
-
def self.validate_yaml(file_path)
|
23
|
-
YAML.load_file(file_path)
|
24
|
-
puts "#{file_path} is a valid YAML file."
|
25
|
-
rescue Psych::SyntaxError => e
|
26
|
-
raise "YAML validation failed for #{file_path}: #{e}"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "yaml"
|
4
|
+
|
5
|
+
# frozen_string_literal: true
|
6
|
+
|
7
|
+
# This module provides classes for the Makit gem.
|
8
|
+
module Makit
|
9
|
+
# YAML file validation utilities
|
10
|
+
#
|
11
|
+
# This class provides methods for validating YAML file syntax
|
12
|
+
# and structure, helping to catch configuration errors early.
|
13
|
+
class Yaml
|
14
|
+
# Validate YAML file syntax and structure
|
15
|
+
#
|
16
|
+
# Attempts to parse a YAML file to verify it has valid syntax.
|
17
|
+
# Prints a success message if valid, raises an error if invalid.
|
18
|
+
#
|
19
|
+
# @param file_path [String] Path to the YAML file to validate
|
20
|
+
# @return [nil] Prints success message if validation passes
|
21
|
+
# @raise [RuntimeError] If YAML syntax is invalid
|
22
|
+
def self.validate_yaml(file_path)
|
23
|
+
YAML.load_file(file_path)
|
24
|
+
puts "#{file_path} is a valid YAML file."
|
25
|
+
rescue Psych::SyntaxError => e
|
26
|
+
raise "YAML validation failed for #{file_path}: #{e}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/makit/zip.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "zip"
|
4
|
-
require "fileutils"
|
5
|
-
|
6
|
-
module Makit
|
7
|
-
# Zip a directory
|
8
|
-
class Zip
|
9
|
-
def self.zip_directory(directory, zip_file)
|
10
|
-
::Zip::File.open(zip_file, ::Zip::File::CREATE) do |zipfile|
|
11
|
-
Dir[File.join(directory, "**", "**")].each do |file|
|
12
|
-
zipfile.add(file.sub("#{directory}/", ""), file)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "zip"
|
4
|
+
require "fileutils"
|
5
|
+
|
6
|
+
module Makit
|
7
|
+
# Zip a directory
|
8
|
+
class Zip
|
9
|
+
def self.zip_directory(directory, zip_file)
|
10
|
+
::Zip::File.open(zip_file, ::Zip::File::CREATE) do |zipfile|
|
11
|
+
Dir[File.join(directory, "**", "**")].each do |file|
|
12
|
+
zipfile.add(file.sub("#{directory}/", ""), file)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|