makit 0.0.0 → 0.0.1
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/.rubocop.yml +22 -22
- data/CHANGELOG.md +8 -8
- data/CODE_OF_CONDUCT.md +84 -84
- data/Rakefile +20 -10
- data/examples/rake_default/Rakefile +1 -0
- data/lib/makit/command_runner.rb +4 -4
- data/lib/makit/content/default_gitignore.txt +222 -222
- data/lib/makit/directory.rb +1 -1
- data/lib/makit/dotnet.rb +62 -3
- data/lib/makit/mp/project_mp.rb +77 -88
- data/lib/makit/mp/string_mp.rb +5 -5
- data/lib/makit/tasks.rb +7 -3
- data/lib/makit/v1/makit.v1.proto +2 -2
- data/lib/makit/v1/makit.v1_pb.rb +1 -1
- data/lib/makit/v1/makit.v1_services_pb.rb +3 -4
- data/lib/makit/version.rb +1 -1
- data/lib/makit/wix.rb +4 -1
- data/lib/makit.rb +1 -1
- data/sig/makit.rbs +4 -4
- metadata +6 -6
data/lib/makit/mp/project_mp.rb
CHANGED
@@ -7,27 +7,44 @@ module Makit
|
|
7
7
|
class Project
|
8
8
|
def to_yaml
|
9
9
|
data = JSON.parse(self.to_pretty_json)
|
10
|
-
data.to_yaml.sub(/^---\n/,
|
10
|
+
data.to_yaml.sub(/^---\n/, "")
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.create
|
14
|
-
project =
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
project = Makit::V1::Project.new
|
15
|
+
project.set_default_values
|
16
|
+
project
|
17
|
+
end
|
18
|
+
|
19
|
+
def open(filename)
|
20
|
+
other = Makit::V1::Project::create_from_file(filename)
|
21
|
+
self.name = other.name
|
22
|
+
self.git_remote_url = other.git_remote_url
|
23
|
+
self.dotnet_projects = other.dotnet_projects
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.create_from_file(filename)
|
27
|
+
extension = File.extname(filename)
|
28
|
+
case extension
|
29
|
+
when ".yml"
|
30
|
+
yaml = File.read(filename)
|
31
|
+
create_from_yaml(yaml)
|
32
|
+
when ".json"
|
33
|
+
json = File.read(filename)
|
34
|
+
create_from_json(json)
|
22
35
|
else
|
23
|
-
|
24
|
-
json = File.read("project.json")
|
25
|
-
project = Makit::V1::Project.decode_json(json)
|
26
|
-
else
|
27
|
-
project = Makit::V1::Project.new
|
28
|
-
end
|
36
|
+
raise "unsupported file extension: #{extension}"
|
29
37
|
end
|
30
|
-
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.create_from_yaml(yaml)
|
41
|
+
json = JSON.pretty_generate(YAML.load(yaml))
|
42
|
+
project = Makit::V1::Project.decode_json(json)
|
43
|
+
project
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.create_from_json(json)
|
47
|
+
project = Makit::V1::Project.decode_json(json)
|
31
48
|
project
|
32
49
|
end
|
33
50
|
|
@@ -35,27 +52,28 @@ module Makit
|
|
35
52
|
#self.language = "csharp"
|
36
53
|
#self.primary_artifact_type = "nuget"
|
37
54
|
if self.git_remote_url.nil? || self.git_remote_url.empty?
|
38
|
-
|
55
|
+
self.git_remote_url = `git remote get-url origin`.strip
|
39
56
|
end
|
40
57
|
if self.name.nil? || self.name.empty?
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
58
|
+
if (!self.git_remote_url.nil? && !self.git_remote_url.empty?)
|
59
|
+
self.name = get_name(File.basename(self.git_remote_url, ".git")) # get_capitalized_name(File.basename(self.git_remote_url, ".git"))
|
60
|
+
else
|
61
|
+
self.name = get_name(File.basename(Dir.getwd)) # get_capitalized_name(File.basename(Dir.getwd))
|
62
|
+
end
|
46
63
|
end
|
47
64
|
self
|
48
65
|
end
|
49
66
|
|
50
67
|
def get_name(name)
|
51
68
|
if !self.git_remote_url.nil? && !self.git_remote_url.empty?
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
69
|
+
is_dotnet = self.git_remote_url.include?("nuget")
|
70
|
+
if is_dotnet
|
71
|
+
get_capitalized_name(name)
|
72
|
+
end
|
56
73
|
end
|
57
74
|
name.downcase
|
58
75
|
end
|
76
|
+
|
59
77
|
def get_capitalized_name(name)
|
60
78
|
name.split(".").map(&:capitalize).join(".")
|
61
79
|
end
|
@@ -72,89 +90,60 @@ module Makit
|
|
72
90
|
end
|
73
91
|
end
|
74
92
|
|
75
|
-
def with_dotnet_project(template,name,output)
|
76
|
-
if !self.dotnet_projects.any? { |project| project.output== output }
|
93
|
+
def with_dotnet_project(template, name, output)
|
94
|
+
if !self.dotnet_projects.any? { |project| project.output == output }
|
77
95
|
project = Makit::V1::DotNetProject.new
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
96
|
+
project.template = template
|
97
|
+
project.name = name
|
98
|
+
project.output = output
|
99
|
+
self.dotnet_projects << project
|
82
100
|
end
|
83
101
|
end
|
84
102
|
|
103
|
+
def setup
|
104
|
+
setup_dotnet_projects
|
105
|
+
end
|
106
|
+
|
85
107
|
def setup_dotnet_projects
|
86
108
|
if self.dotnet_projects.any?
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
109
|
+
if (!File.exist?("#{self.name}.sln"))
|
110
|
+
puts " Creating solution file: " + "#{self.name}.sln".colorize(:green)
|
111
|
+
"dotnet new sln -n #{self.name}".run unless File.exist?("#{self.name}.sln")
|
112
|
+
else
|
113
|
+
puts " Solution file already exists: " + "#{self.name}.sln".colorize(:yellow)
|
114
|
+
end
|
115
|
+
self.dotnet_projects.each do |project|
|
116
|
+
add_project = true
|
117
|
+
if (project.os == "windows" && !Makit::Environment.is_windows?)
|
118
|
+
add_project = false
|
92
119
|
end
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
"dotnet sln #{self.name}.sln add #{project.output}/#{project.name}.csproj".run
|
101
|
-
else
|
102
|
-
puts " Project file already exists: " + "#{project.name}/#{project.name}.csproj".colorize(:yellow)
|
103
|
-
end
|
120
|
+
if (add_project)
|
121
|
+
Makit::DotNet.new_project(project.template, project.name, project.output)
|
122
|
+
# add any nuget packages to the project
|
123
|
+
project_filename = "#{project.output}/#{project.name}.csproj"
|
124
|
+
project.packages.each { |package|
|
125
|
+
Makit::DotNet::add_package(project_filename, package)
|
126
|
+
}
|
104
127
|
end
|
128
|
+
end
|
129
|
+
Makit::DotNet.new_solution(self.name)
|
130
|
+
Makit::DotNet.sln_add_projects(self.name)
|
105
131
|
else
|
106
|
-
|
132
|
+
puts " no dotnet projects found".colorize(:yellow)
|
107
133
|
end
|
108
134
|
end
|
109
135
|
|
110
136
|
def build_dotnet_projects
|
111
137
|
self.dotnet_projects.each do |project|
|
112
|
-
|
138
|
+
"dotnet build #{project.output} --configuration Release".run
|
113
139
|
end
|
114
140
|
end
|
115
141
|
|
116
142
|
def test_dotnet_projects
|
117
143
|
self.dotnet_projects.each do |project|
|
118
|
-
|
144
|
+
"dotnet test #{project.output} --configuration Release".run
|
119
145
|
end
|
120
146
|
end
|
121
147
|
end # class Project
|
122
148
|
end # module V1
|
123
149
|
end # module Makit
|
124
|
-
|
125
|
-
|
126
|
-
#task :setup do
|
127
|
-
# if(Makit::PROJECT.git_remote_url.include?("nuget") ||
|
128
|
-
# Makit::PROJECT.primary_artifact_type.include?("nuget"))
|
129
|
-
|
130
|
-
# if(!File.exist?("#{Makit::PROJECT.name}.sln"))
|
131
|
-
# puts " Creating solution file: " + "#{Makit::PROJECT.name}.sln".colorize(:green)
|
132
|
-
# "dotnet new sln -n #{Makit::PROJECT.name}".run unless File.exist?("#{Makit::PROJECT.name}.sln")
|
133
|
-
# end
|
134
|
-
# end
|
135
|
-
|
136
|
-
# Makit::PROJECT.dotnet_projects.each do |project|
|
137
|
-
# if(!Dir.exist?("#{project.output}"))
|
138
|
-
# puts " Creating project file: " + "#{project.name}/#{project.name}.csproj".colorize(:green)
|
139
|
-
# "dotnet new #{project.template} -n #{project.name} -o #{project.output}".run unless Dir.exist?("#{project.output}")
|
140
|
-
# end
|
141
|
-
# end
|
142
|
-
|
143
|
-
# add all .csproj file to the .sln
|
144
|
-
# Dir.glob("**/*.csproj").each do |file|
|
145
|
-
# "dotnet sln #{Makit::PROJECT.name}.sln add #{file}".run
|
146
|
-
# end
|
147
|
-
#template = "nunit"
|
148
|
-
#"dotnet new #{template} -n #{Makit::PROJECT.name}.Tests -o src/#{Makit::PROJECT.name}".run unless Dir.exist?("#{Makit::PROJECT.name}.Tests")
|
149
|
-
|
150
|
-
#if(Makit::PROJECt.primary_artifact_type.include?("nuget"))
|
151
|
-
# puts
|
152
|
-
#end
|
153
|
-
# end
|
154
|
-
|
155
|
-
|
156
|
-
#"dotnet build src/Facilities.Models/Facilities.Models.csproj --configuration Release".run
|
157
|
-
# "dotnet build test/Facilities.Models.Tests/Facilities.Models.Tests.csproj --configuration Release".run
|
158
|
-
# "dotnet build examples/Facilities.Models.Wasm.Demo/Facilities.Models.Wasm.Demo.csproj --configuration Release".run
|
159
|
-
|
160
|
-
#"dotnet test test/Facilities.Models.Tests/Facilities.Models.Tests.csproj --configuration Release".run
|
data/lib/makit/mp/string_mp.rb
CHANGED
@@ -74,8 +74,8 @@ class String
|
|
74
74
|
# Alias for set_json_value
|
75
75
|
alias_method :assign, :set_json_value
|
76
76
|
|
77
|
-
def to_lines(max_length=80,indent_length=5)
|
78
|
-
if(self.length <= max_length)
|
77
|
+
def to_lines(max_length = 80, indent_length = 5)
|
78
|
+
if (self.length <= max_length)
|
79
79
|
return self
|
80
80
|
else
|
81
81
|
indent = " " * indent_length
|
@@ -83,14 +83,14 @@ class String
|
|
83
83
|
lines = []
|
84
84
|
line = ""
|
85
85
|
words.each do |word|
|
86
|
-
if((line + word).length > max_length)
|
86
|
+
if ((line + word).length > max_length)
|
87
87
|
lines << line
|
88
88
|
line = indent + word
|
89
89
|
else
|
90
|
-
if(line.length == 0)
|
90
|
+
if (line.length == 0)
|
91
91
|
line = word
|
92
92
|
else
|
93
|
-
|
93
|
+
line += " " + word
|
94
94
|
end
|
95
95
|
end
|
96
96
|
end
|
data/lib/makit/tasks.rb
CHANGED
@@ -12,9 +12,9 @@ at_exit do
|
|
12
12
|
#json_filename = File.join(Makit::Directories::PROJECT_ROOT, ".makit.project.json")
|
13
13
|
#puts "Saving project state to #{json_filename}"
|
14
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)
|
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
18
|
end
|
19
19
|
|
20
20
|
# This module provides classes for the Makit gem.
|
@@ -61,3 +61,7 @@ task :update do
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
+
# Register the at_exit hook for cleanup
|
65
|
+
at_exit do
|
66
|
+
puts "at_exit in tasks.rb...."
|
67
|
+
end
|
data/lib/makit/v1/makit.v1.proto
CHANGED
@@ -18,6 +18,8 @@ message DotNetProject{
|
|
18
18
|
string template = 1;
|
19
19
|
string name = 2;
|
20
20
|
string output = 3;
|
21
|
+
repeated string packages = 4;
|
22
|
+
string os = 5;
|
21
23
|
}
|
22
24
|
|
23
25
|
message Project {
|
@@ -26,8 +28,6 @@ message Project {
|
|
26
28
|
repeated DotNetProject dotnet_projects = 5;
|
27
29
|
}
|
28
30
|
|
29
|
-
|
30
|
-
|
31
31
|
enum PackageType{
|
32
32
|
GEM = 0;
|
33
33
|
NUGET = 1;
|
data/lib/makit/v1/makit.v1_pb.rb
CHANGED
@@ -8,7 +8,7 @@ require 'google/protobuf/timestamp_pb'
|
|
8
8
|
require 'google/protobuf/duration_pb'
|
9
9
|
|
10
10
|
|
11
|
-
descriptor_data = "\n\x1blib/makit/v1/makit.v1.proto\x12\x08makit.v1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/duration.proto\"
|
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\x12\x10\n\x08packages\x18\x04 \x03(\t\x12\n\n\x02os\x18\x05 \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
12
|
|
13
13
|
pool = Google::Protobuf::DescriptorPool.generated_pool
|
14
14
|
pool.add_serialized_file(descriptor_data)
|
@@ -1,20 +1,19 @@
|
|
1
1
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
2
|
# Source: lib/makit/v1/makit.v1.proto for package 'makit.v1'
|
3
3
|
|
4
|
-
require
|
5
|
-
require_relative
|
4
|
+
require "grpc"
|
5
|
+
require_relative "makit.v1_pb"
|
6
6
|
|
7
7
|
module Makit
|
8
8
|
module V1
|
9
9
|
module CommandService
|
10
10
|
# Service to execute commands on devices.
|
11
11
|
class Service
|
12
|
-
|
13
12
|
include ::GRPC::GenericService
|
14
13
|
|
15
14
|
self.marshal_class_method = :encode
|
16
15
|
self.unmarshal_class_method = :decode
|
17
|
-
self.service_name =
|
16
|
+
self.service_name = "makit.v1.CommandService"
|
18
17
|
|
19
18
|
# Execute a command on a device.
|
20
19
|
rpc :Execute, ::Makit::V1::CommandRequest, ::Makit::V1::Command
|
data/lib/makit/version.rb
CHANGED
data/lib/makit/wix.rb
CHANGED
@@ -17,7 +17,10 @@ module Makit
|
|
17
17
|
if !Makit::DotNet::is_installed? # !File.exist?(Makit::Environment.which("dotnet"))
|
18
18
|
puts "dotnet does not appear to be installed"
|
19
19
|
else
|
20
|
-
|
20
|
+
# test if wix is already installed
|
21
|
+
if !`dotnet tool list --global`.include?("wix")
|
22
|
+
"dotnet tool install --global wix".run
|
23
|
+
end
|
21
24
|
puts " Wix version " + "#{Wix::version}".colorize(:green)
|
22
25
|
# display the link to https://wixtoolset.org/
|
23
26
|
puts " https://wixtoolset.org/".colorize(:green)
|
data/lib/makit.rb
CHANGED
data/sig/makit.rbs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
module Makit
|
2
|
-
VERSION: String
|
3
|
-
# See the writing guide of rbs: https://github.com/ruby/rbs#guides
|
4
|
-
end
|
1
|
+
module Makit
|
2
|
+
VERSION: String
|
3
|
+
# See the writing guide of rbs: https://github.com/ruby/rbs#guides
|
4
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: makit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lou Parslow
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 4.28.
|
47
|
+
version: 4.28.3
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 4.28.
|
54
|
+
version: 4.28.3
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: grpc
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,7 +136,7 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0.3'
|
139
|
-
description:
|
139
|
+
description: CI/CD tools for Ruby developers.
|
140
140
|
email:
|
141
141
|
- lou.parslow@gmail.com
|
142
142
|
executables:
|
@@ -244,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
244
244
|
- !ruby/object:Gem::Version
|
245
245
|
version: '0'
|
246
246
|
requirements: []
|
247
|
-
rubygems_version: 3.5.
|
247
|
+
rubygems_version: 3.5.20
|
248
248
|
signing_key:
|
249
249
|
specification_version: 4
|
250
250
|
summary: CI/CD tools for Ruby developers.
|