makit 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.makit.project.json +4 -0
- data/.makit.project.yml +2 -0
- data/.rubocop.yml +22 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +8 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/LICENSE +21 -0
- data/README.md +119 -0
- data/Rakefile +190 -0
- data/docs/Commands.md +50 -0
- data/docs_/Commands.md +166 -0
- data/docs_/Minitest.Timeouts.md +332 -0
- data/examples/protoc/Rakefile +31 -0
- data/examples/rake_default/Rakefile +5 -0
- data/examples/rubygem-foo/.gitkeep +0 -0
- data/examples/rubygem-foo/Rakefile +3 -0
- data/examples/run_mp/Rakefile +8 -0
- data/exe/makit +5 -0
- data/lib/makit/apache.rb +32 -0
- data/lib/makit/cli/clean.rb +14 -0
- data/lib/makit/cli/clone.rb +59 -0
- data/lib/makit/cli/init.rb +38 -0
- data/lib/makit/cli/main.rb +33 -0
- data/lib/makit/cli/make.rb +54 -0
- data/lib/makit/cli/new.rb +37 -0
- data/lib/makit/cli/nuget_cache.rb +38 -0
- data/lib/makit/cli/pull.rb +31 -0
- data/lib/makit/cli/setup.rb +71 -0
- data/lib/makit/cli/work.rb +21 -0
- data/lib/makit/command_runner.rb +237 -0
- data/lib/makit/commands.rb +21 -0
- data/lib/makit/content/default_gitignore.rb +5 -0
- data/lib/makit/content/default_gitignore.txt +222 -0
- data/lib/makit/content/default_rakefile.rb +11 -0
- data/lib/makit/content/gem_rakefile.rb +14 -0
- data/lib/makit/content/ruby_gitlab-ci.yml +15 -0
- data/lib/makit/data.rb +50 -0
- data/lib/makit/directories.rb +140 -0
- data/lib/makit/directory.rb +120 -0
- data/lib/makit/dotnet.rb +16 -0
- data/lib/makit/environment.rb +123 -0
- data/lib/makit/files.rb +47 -0
- data/lib/makit/git.rb +66 -0
- data/lib/makit/gitlab_runner.rb +60 -0
- data/lib/makit/humanize.rb +89 -0
- data/lib/makit/logging.rb +96 -0
- data/lib/makit/markdown.rb +75 -0
- data/lib/makit/mp/basic_object_mp.rb +16 -0
- data/lib/makit/mp/project_mp.rb +160 -0
- data/lib/makit/mp/string_mp.rb +101 -0
- data/lib/makit/nuget.rb +57 -0
- data/lib/makit/protoc.rb +61 -0
- data/lib/makit/serializer.rb +70 -0
- data/lib/makit/storage.rb +131 -0
- data/lib/makit/symbols.rb +149 -0
- data/lib/makit/tasks.rb +63 -0
- data/lib/makit/tree.rb +37 -0
- data/lib/makit/v1/makit.v1.proto +103 -0
- data/lib/makit/v1/makit.v1_pb.rb +30 -0
- data/lib/makit/v1/makit.v1_services_pb.rb +26 -0
- data/lib/makit/version.rb +12 -0
- data/lib/makit/wix.rb +92 -0
- data/lib/makit/zip.rb +17 -0
- data/lib/makit.rb +243 -0
- data/makit.generated.sln +30 -0
- data/makit.sln +69 -0
- data/pages/.gitignore +5 -0
- data/pages/404.html +25 -0
- data/pages/Gemfile +33 -0
- data/pages/Gemfile.lock +88 -0
- data/pages/_config.yml +55 -0
- data/pages/_layouts/default.html +1 -0
- data/pages/_posts/2024-10-05-welcome-to-jekyll.markdown +29 -0
- data/pages/about.markdown +18 -0
- data/pages/index.markdown +6 -0
- data/sig/makit.rbs +4 -0
- data/src/ClassLib/Class1.cs +6 -0
- data/src/ClassLib/ClassLib.csproj +13 -0
- metadata +251 -0
@@ -0,0 +1,149 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rainbow"
|
4
|
+
|
5
|
+
# https://symbl.cc/en/unicode/table/
|
6
|
+
module Makit
|
7
|
+
class Symbols
|
8
|
+
def self.checkmark
|
9
|
+
"\u2713"
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.success
|
13
|
+
"\u2713"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.error
|
17
|
+
Rainbow("\u0058").red
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.warning
|
21
|
+
Rainbow("\u26A0").yellow
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.debug
|
25
|
+
Rainbow("\u24D8").blue # Circle with "i"
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.info
|
29
|
+
Rainbow("\u2139").blue # Information source
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.fatal
|
33
|
+
Rainbow("\u25A0").bright.red # Filled square, indicating stop/critical
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.warn
|
37
|
+
Rainbow("\u26A0").yellow # Warning sign
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.star
|
41
|
+
Rainbow("\u2605").yellow # Star
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.coffee
|
45
|
+
Rainbow("\u2615").yellow # Hot beverage
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.heart
|
49
|
+
Rainbow("\u2764").red # Heavy black heart
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.bug
|
53
|
+
Rainbow("\u1F41E").yellow # Bug
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.gear
|
57
|
+
Rainbow("\u2699").yellow # Gear
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.magnifying_glass
|
61
|
+
Rainbow("\u1F50D").yellow # Left-pointing magnifying glass
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.question
|
65
|
+
Rainbow("\u003F").yellow # Question mark
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.arrow_right
|
69
|
+
Rainbow("\u27A4").yellow # Arrow pointing rightwards then curving upwards
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.arrow_left
|
73
|
+
Rainbow("\u2B05").yellow # Left arrow
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.arrow_up
|
77
|
+
Rainbow("\u2B06").yellow # Up arrow
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.arrow_down
|
81
|
+
Rainbow("\u2B07").yellow # Down arrow
|
82
|
+
end
|
83
|
+
|
84
|
+
def self.arrow_up_down
|
85
|
+
Rainbow("\u2195").yellow # Up/down arrow
|
86
|
+
end
|
87
|
+
|
88
|
+
def self.arrow_left_right
|
89
|
+
Rainbow("\u2194").yellow # Left/right arrow
|
90
|
+
end
|
91
|
+
|
92
|
+
def self.arrow_upper_right
|
93
|
+
Rainbow("\u2197").yellow # North east arrow
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.arrow_lower_right
|
97
|
+
Rainbow("\u2198").yellow # South east arrow
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.arrow_lower_left
|
101
|
+
Rainbow("\u2199").yellow # South west arrow
|
102
|
+
end
|
103
|
+
|
104
|
+
def self.arrow_upper_left
|
105
|
+
Rainbow("\u2196").yellow # North west arrow
|
106
|
+
end
|
107
|
+
|
108
|
+
def self.arrow_up_small
|
109
|
+
Rainbow("\u2B06").yellow # Up arrow
|
110
|
+
end
|
111
|
+
|
112
|
+
def self.arrow_down_small
|
113
|
+
Rainbow("\u2B07").yellow # Down arrow
|
114
|
+
end
|
115
|
+
|
116
|
+
def self.arrow_right_small
|
117
|
+
Rainbow("\u27A1").yellow # Black rightwards arrow
|
118
|
+
end
|
119
|
+
|
120
|
+
def self.arrow_left_small
|
121
|
+
Rainbow("\u2B05").yellow # Left arrow
|
122
|
+
end
|
123
|
+
|
124
|
+
def self.arrow_up_down_small
|
125
|
+
Rainbow("\u2195").yellow # Up/down arrow
|
126
|
+
end
|
127
|
+
|
128
|
+
def self.music
|
129
|
+
Rainbow("\u266B").yellow # Beamed eighth notes
|
130
|
+
end
|
131
|
+
|
132
|
+
def self.get_severity_symbol(severity)
|
133
|
+
case severity
|
134
|
+
when "DEBUG"
|
135
|
+
question
|
136
|
+
# when "INFO"
|
137
|
+
# info
|
138
|
+
when "WARN"
|
139
|
+
warning
|
140
|
+
when "ERROR"
|
141
|
+
error
|
142
|
+
when "FATAL"
|
143
|
+
fatal
|
144
|
+
else
|
145
|
+
" "
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
data/lib/makit/tasks.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "digest"
|
3
|
+
require "rake/clean"
|
4
|
+
#require "sqlite3"
|
5
|
+
|
6
|
+
# Register the at_exit hook for cleanup
|
7
|
+
at_exit do
|
8
|
+
puts "Performing cleanup for Makit..."
|
9
|
+
# Add your cleanup code here
|
10
|
+
# For example, close files, remove temporary files, etc.
|
11
|
+
# store current state of Makit::PROJECT to a file
|
12
|
+
#json_filename = File.join(Makit::Directories::PROJECT_ROOT, ".makit.project.json")
|
13
|
+
#puts "Saving project state to #{json_filename}"
|
14
|
+
#Makit::PROJECT.save_as(json_filename)
|
15
|
+
yml_filename = File.join(Makit::Directories::PROJECT_ROOT, ".makit.project.yml")
|
16
|
+
puts "Saving project state to #{yml_filename}"
|
17
|
+
Makit::PROJECT.save_as(yml_filename)
|
18
|
+
end
|
19
|
+
|
20
|
+
# This module provides classes for the Makit gem.
|
21
|
+
module Makit
|
22
|
+
# This class provide methods for managing persistent data for the makit gem
|
23
|
+
class Tasks
|
24
|
+
def self.run_default_commands(task_name)
|
25
|
+
Makit::LOGGER.debug("Running default commands for task: #{task_name}")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "Remove any temporary products."
|
31
|
+
task :clean do
|
32
|
+
puts ":clean".colorize(:blue)
|
33
|
+
Makit::RUNNER.run(Makit::RUNNER.parse_command_request("git clean -dXf"))
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "Integrate changes into the git repository."
|
37
|
+
task :integrate do
|
38
|
+
puts ":integrate".colorize(:blue)
|
39
|
+
Makit::Git.integrate
|
40
|
+
end
|
41
|
+
|
42
|
+
desc "Sync changes with the git repository."
|
43
|
+
task :sync do
|
44
|
+
puts ":sync".colorize(:blue)
|
45
|
+
Makit::Git.sync
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "Format source code."
|
49
|
+
task :format do
|
50
|
+
puts ":format".colorize(:blue)
|
51
|
+
Makit::RUNNER.try("rufo .") if File.exist?("Gemfile") || File.exist?("Rakefile")
|
52
|
+
end
|
53
|
+
|
54
|
+
desc "Update dependencies."
|
55
|
+
task :update do
|
56
|
+
puts ":update".colorize(:blue)
|
57
|
+
system("bundle update") if File.exist?("Gemfile")
|
58
|
+
# glob all *.csproj files
|
59
|
+
Dir.glob("**/*.csproj").each do |file|
|
60
|
+
"dotnet format #{file}".run
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
data/lib/makit/tree.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This module provides classes for the Makit gem.
|
4
|
+
module Makit
|
5
|
+
class Tree
|
6
|
+
def get_source_tree
|
7
|
+
files = `git ls-files`.split("\n")
|
8
|
+
tree = {}
|
9
|
+
|
10
|
+
# Build a nested hash representing the file structure
|
11
|
+
files.each do |file|
|
12
|
+
parts = file.split("/")
|
13
|
+
current = tree
|
14
|
+
|
15
|
+
parts.each_with_index do |part, index|
|
16
|
+
current[part] ||= (index == parts.length - 1 ? nil : {})
|
17
|
+
current = current[part] unless current[part].nil?
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
generate_tree_string(tree)
|
22
|
+
end
|
23
|
+
|
24
|
+
def generate_tree_string(tree, indent = "")
|
25
|
+
result = ""
|
26
|
+
tree.each do |key, value|
|
27
|
+
if value.is_a?(Hash)
|
28
|
+
result << "#{indent}#{key}/\n"
|
29
|
+
result << generate_tree_string(value, "#{indent} ")
|
30
|
+
else
|
31
|
+
result << "#{indent}#{key}\n"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
result
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
syntax = "proto3";
|
2
|
+
|
3
|
+
package makit.v1;
|
4
|
+
|
5
|
+
import "google/protobuf/timestamp.proto";
|
6
|
+
import "google/protobuf/duration.proto";
|
7
|
+
|
8
|
+
|
9
|
+
// docker run -p 9011:9011 -v /tmp/liget-set/:/data tomzo/liget:latest
|
10
|
+
|
11
|
+
enum Language {
|
12
|
+
RUBY = 0;
|
13
|
+
CSHARP = 1;
|
14
|
+
RUST = 2;
|
15
|
+
}
|
16
|
+
|
17
|
+
message DotNetProject{
|
18
|
+
string template = 1;
|
19
|
+
string name = 2;
|
20
|
+
string output = 3;
|
21
|
+
}
|
22
|
+
|
23
|
+
message Project {
|
24
|
+
string git_remote_url = 1;
|
25
|
+
string name = 2;
|
26
|
+
repeated DotNetProject dotnet_projects = 5;
|
27
|
+
}
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
enum PackageType{
|
32
|
+
GEM = 0;
|
33
|
+
NUGET = 1;
|
34
|
+
CRATE = 3;
|
35
|
+
}
|
36
|
+
|
37
|
+
message CommandRequest {
|
38
|
+
string name = 1;
|
39
|
+
repeated string arguments = 2;
|
40
|
+
google.protobuf.Timestamp timeout = 3;
|
41
|
+
string directory = 4;
|
42
|
+
string task = 5;
|
43
|
+
bytes input = 6;
|
44
|
+
bool exit_on_error = 7;
|
45
|
+
}
|
46
|
+
|
47
|
+
// Command represents a command to be executed on a device.
|
48
|
+
message Command {
|
49
|
+
int64 id = 1;
|
50
|
+
string name = 2;
|
51
|
+
repeated string arguments = 3;
|
52
|
+
int32 exit_code = 4;
|
53
|
+
bytes input = 5;
|
54
|
+
bytes output = 6;
|
55
|
+
bytes error = 7;
|
56
|
+
google.protobuf.Timestamp started_at = 8;
|
57
|
+
google.protobuf.Duration duration = 9;
|
58
|
+
string user = 10;
|
59
|
+
string device = 11;
|
60
|
+
string os = 12;
|
61
|
+
string directory = 13;
|
62
|
+
}
|
63
|
+
|
64
|
+
// Service to execute commands on devices.
|
65
|
+
service CommandService {
|
66
|
+
// Execute a command on a device.
|
67
|
+
rpc Execute(CommandRequest) returns (Command);
|
68
|
+
}
|
69
|
+
|
70
|
+
message Configuration {
|
71
|
+
string name = 1;
|
72
|
+
repeated CommandRequest commands = 2;
|
73
|
+
}
|
74
|
+
|
75
|
+
message GitRepository {
|
76
|
+
string url = 1;
|
77
|
+
string relative_path = 2;
|
78
|
+
}
|
79
|
+
|
80
|
+
message GitLogEntry{
|
81
|
+
string commit = 1;
|
82
|
+
string author = 2;
|
83
|
+
google.protobuf.Timestamp date = 3;
|
84
|
+
string message = 4;
|
85
|
+
}
|
86
|
+
|
87
|
+
message MakeResult{
|
88
|
+
string repository = 1;
|
89
|
+
string commit = 2;
|
90
|
+
string branch = 3;
|
91
|
+
string tag = 4;
|
92
|
+
string device = 5;
|
93
|
+
string runtime_identifier = 6;
|
94
|
+
repeated Command commands = 7;
|
95
|
+
int32 initial_size = 8;
|
96
|
+
int32 final_size = 9;
|
97
|
+
}
|
98
|
+
|
99
|
+
message DotNetNewArgs{
|
100
|
+
string template = 1;
|
101
|
+
string name = 2;
|
102
|
+
string output = 3;
|
103
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
# source: lib/makit/v1/makit.v1.proto
|
4
|
+
|
5
|
+
require 'google/protobuf'
|
6
|
+
|
7
|
+
require 'google/protobuf/timestamp_pb'
|
8
|
+
require 'google/protobuf/duration_pb'
|
9
|
+
|
10
|
+
|
11
|
+
descriptor_data = "\n\x1blib/makit/v1/makit.v1.proto\x12\x08makit.v1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/duration.proto\"?\n\rDotNetProject\x12\x10\n\x08template\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0e\n\x06output\x18\x03 \x01(\t\"a\n\x07Project\x12\x16\n\x0egit_remote_url\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x30\n\x0f\x64otnet_projects\x18\x05 \x03(\x0b\x32\x17.makit.v1.DotNetProject\"\xa5\x01\n\x0e\x43ommandRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x11\n\targuments\x18\x02 \x03(\t\x12+\n\x07timeout\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x11\n\tdirectory\x18\x04 \x01(\t\x12\x0c\n\x04task\x18\x05 \x01(\t\x12\r\n\x05input\x18\x06 \x01(\x0c\x12\x15\n\rexit_on_error\x18\x07 \x01(\x08\"\x91\x02\n\x07\x43ommand\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x11\n\targuments\x18\x03 \x03(\t\x12\x11\n\texit_code\x18\x04 \x01(\x05\x12\r\n\x05input\x18\x05 \x01(\x0c\x12\x0e\n\x06output\x18\x06 \x01(\x0c\x12\r\n\x05\x65rror\x18\x07 \x01(\x0c\x12.\n\nstarted_at\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12+\n\x08\x64uration\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x0c\n\x04user\x18\n \x01(\t\x12\x0e\n\x06\x64\x65vice\x18\x0b \x01(\t\x12\n\n\x02os\x18\x0c \x01(\t\x12\x11\n\tdirectory\x18\r \x01(\t\"I\n\rConfiguration\x12\x0c\n\x04name\x18\x01 \x01(\t\x12*\n\x08\x63ommands\x18\x02 \x03(\x0b\x32\x18.makit.v1.CommandRequest\"3\n\rGitRepository\x12\x0b\n\x03url\x18\x01 \x01(\t\x12\x15\n\rrelative_path\x18\x02 \x01(\t\"h\n\x0bGitLogEntry\x12\x0e\n\x06\x63ommit\x18\x01 \x01(\t\x12\x0e\n\x06\x61uthor\x18\x02 \x01(\t\x12(\n\x04\x64\x61te\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0f\n\x07message\x18\x04 \x01(\t\"\xc8\x01\n\nMakeResult\x12\x12\n\nrepository\x18\x01 \x01(\t\x12\x0e\n\x06\x63ommit\x18\x02 \x01(\t\x12\x0e\n\x06\x62ranch\x18\x03 \x01(\t\x12\x0b\n\x03tag\x18\x04 \x01(\t\x12\x0e\n\x06\x64\x65vice\x18\x05 \x01(\t\x12\x1a\n\x12runtime_identifier\x18\x06 \x01(\t\x12#\n\x08\x63ommands\x18\x07 \x03(\x0b\x32\x11.makit.v1.Command\x12\x14\n\x0cinitial_size\x18\x08 \x01(\x05\x12\x12\n\nfinal_size\x18\t \x01(\x05\"?\n\rDotNetNewArgs\x12\x10\n\x08template\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0e\n\x06output\x18\x03 \x01(\t**\n\x08Language\x12\x08\n\x04RUBY\x10\x00\x12\n\n\x06\x43SHARP\x10\x01\x12\x08\n\x04RUST\x10\x02*,\n\x0bPackageType\x12\x07\n\x03GEM\x10\x00\x12\t\n\x05NUGET\x10\x01\x12\t\n\x05\x43RATE\x10\x03\x32H\n\x0e\x43ommandService\x12\x36\n\x07\x45xecute\x12\x18.makit.v1.CommandRequest\x1a\x11.makit.v1.Commandb\x06proto3"
|
12
|
+
|
13
|
+
pool = Google::Protobuf::DescriptorPool.generated_pool
|
14
|
+
pool.add_serialized_file(descriptor_data)
|
15
|
+
|
16
|
+
module Makit
|
17
|
+
module V1
|
18
|
+
DotNetProject = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.DotNetProject").msgclass
|
19
|
+
Project = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.Project").msgclass
|
20
|
+
CommandRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.CommandRequest").msgclass
|
21
|
+
Command = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.Command").msgclass
|
22
|
+
Configuration = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.Configuration").msgclass
|
23
|
+
GitRepository = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.GitRepository").msgclass
|
24
|
+
GitLogEntry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.GitLogEntry").msgclass
|
25
|
+
MakeResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.MakeResult").msgclass
|
26
|
+
DotNetNewArgs = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.DotNetNewArgs").msgclass
|
27
|
+
Language = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.Language").enummodule
|
28
|
+
PackageType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.PackageType").enummodule
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: lib/makit/v1/makit.v1.proto for package 'makit.v1'
|
3
|
+
|
4
|
+
require 'grpc'
|
5
|
+
require_relative 'makit.v1_pb'
|
6
|
+
|
7
|
+
module Makit
|
8
|
+
module V1
|
9
|
+
module CommandService
|
10
|
+
# Service to execute commands on devices.
|
11
|
+
class Service
|
12
|
+
|
13
|
+
include ::GRPC::GenericService
|
14
|
+
|
15
|
+
self.marshal_class_method = :encode
|
16
|
+
self.unmarshal_class_method = :decode
|
17
|
+
self.service_name = 'makit.v1.CommandService'
|
18
|
+
|
19
|
+
# Execute a command on a device.
|
20
|
+
rpc :Execute, ::Makit::V1::CommandRequest, ::Makit::V1::Command
|
21
|
+
end
|
22
|
+
|
23
|
+
Stub = Service.rpc_stub_class
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Makit
|
4
|
+
VERSION = "0.0.0"
|
5
|
+
|
6
|
+
class Version
|
7
|
+
# given an array of version strings, return the highest version
|
8
|
+
def self.get_highest_version(versions)
|
9
|
+
versions.sort { |a, b| Gem::Version.new(a) <=> Gem::Version.new(b) }.last
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/makit/wix.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
require "securerandom"
|
2
|
+
|
3
|
+
module Makit
|
4
|
+
# This class provide methods for working with the Nuget package cache
|
5
|
+
#
|
6
|
+
# Example:
|
7
|
+
#
|
8
|
+
# Makit::Directory.cache("Google.Protobuf", "3.27.2")
|
9
|
+
#
|
10
|
+
# dotnet nuget locals all --list
|
11
|
+
# dotnet nuget locals all --clear
|
12
|
+
#
|
13
|
+
class Wix
|
14
|
+
def self.setup
|
15
|
+
if (Makit::Environment.is_windows?)
|
16
|
+
# test if dotnet is installed
|
17
|
+
if !Makit::DotNet::is_installed? # !File.exist?(Makit::Environment.which("dotnet"))
|
18
|
+
puts "dotnet does not appear to be installed"
|
19
|
+
else
|
20
|
+
"dotnet tool install --global wix".run
|
21
|
+
puts " Wix version " + "#{Wix::version}".colorize(:green)
|
22
|
+
# display the link to https://wixtoolset.org/
|
23
|
+
puts " https://wixtoolset.org/".colorize(:green)
|
24
|
+
# display the link to https://marketplace.visualstudio.com/items?itemName=FireGiant.FireGiantHeatWaveDev17
|
25
|
+
puts " https://marketplace.visualstudio.com/items?itemName=FireGiant.FireGiantHeatWaveDev17".colorize(:green)
|
26
|
+
end
|
27
|
+
else
|
28
|
+
puts "Wix is not supported on non-Windows platforms"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.version
|
33
|
+
`wix --version`.strip.split("+").first
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.setup_package(name, path, files)
|
37
|
+
# create the path if it does not exist
|
38
|
+
FileUtils.mkdir_p(path) unless File.directory?(path)
|
39
|
+
# create the #{name}.wixproj file
|
40
|
+
File.open("#{path}/#{name}.wixproj", "w") do |f|
|
41
|
+
f.puts "<Project Sdk=\"WixToolset.Sdk/#{Wix::version}\">"
|
42
|
+
f.puts "</Project>"
|
43
|
+
end
|
44
|
+
# create the Package.wxs file
|
45
|
+
File.open("#{path}/Package.wxs", "w") do |f|
|
46
|
+
f.puts "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">"
|
47
|
+
f.puts " <Package Name=\"#{name}\" Manufacturer=\"Acme\" Version=\"0.0.0.0\" UpgradeCode=\"#{SecureRandom.uuid}\">"
|
48
|
+
#f.puts " <MajorUpgrade DowngradeErrorMessage=\"!(loc.DowngradeError)\" />"
|
49
|
+
f.puts " <Files Include=\"#{files}\" />"
|
50
|
+
#f.puts " <Feature Id=\"Main\">"
|
51
|
+
#f.puts " <ComponentGroupRef Id=\"Components\" />"
|
52
|
+
#f.puts " </Feature>"
|
53
|
+
f.puts " </Package>"
|
54
|
+
f.puts "</Wix>"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end # class Wix
|
58
|
+
end # module Makit
|
59
|
+
|
60
|
+
# Package.wxs with File harvesting
|
61
|
+
#<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
62
|
+
# <Package Name="MyProduct" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="B0B15C00-1DC4-0374-A1D1-E902240936D5">
|
63
|
+
# <Files Include="path\to\files\**" />
|
64
|
+
# </Package>
|
65
|
+
#</Wix>
|
66
|
+
|
67
|
+
#<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
68
|
+
# <Package Name="Msi.Demo" Manufacturer="Acme" Version="1.0.0.0" UpgradeCode="a87571ec-8be3-447e-ae23-b3a94a85b727">
|
69
|
+
# <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
|
70
|
+
|
71
|
+
# <Feature Id="Main">
|
72
|
+
# <ComponentGroupRef Id="Components" />
|
73
|
+
# </Feature>
|
74
|
+
# </Package>
|
75
|
+
#</Wix>
|
76
|
+
|
77
|
+
#<Project Sdk="WixToolset.Sdk/5.0.1">
|
78
|
+
#</Project>
|
79
|
+
|
80
|
+
# Components.wxs
|
81
|
+
#<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
82
|
+
# <Fragment>
|
83
|
+
# <ComponentGroup Id="Components" Directory="INSTALLFOLDER">
|
84
|
+
# <Component Guid="b8085fb3-3718-46df-8bf6-ecf9f968dd3d">
|
85
|
+
# <File Source="../../artifacts/Msi.Demo.exe" />
|
86
|
+
# <File Source="../../artifacts/Msi.Demo.dll" />
|
87
|
+
# <File Source="../../artifacts/Msi.Demo.deps.json" />
|
88
|
+
# <File Source="../../artifacts/Msi.Demo.runtimeconfig.json" />
|
89
|
+
# </Component>
|
90
|
+
# </ComponentGroup>
|
91
|
+
# </Fragment>
|
92
|
+
#</Wix>
|
data/lib/makit/zip.rb
ADDED
@@ -0,0 +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
|