makit 0.0.47 → 0.0.48
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/apache.rb +32 -32
- data/lib/makit/cli/clean.rb +14 -14
- data/lib/makit/cli/clone.rb +59 -59
- data/lib/makit/cli/init.rb +38 -38
- data/lib/makit/cli/main.rb +33 -33
- data/lib/makit/cli/make.rb +54 -54
- data/lib/makit/cli/new.rb +37 -37
- data/lib/makit/cli/nuget_cache.rb +38 -38
- data/lib/makit/cli/pull.rb +31 -31
- data/lib/makit/cli/setup.rb +71 -71
- data/lib/makit/cli/work.rb +21 -21
- data/lib/makit/command_runner.rb +391 -400
- data/lib/makit/commands.rb +21 -21
- data/lib/makit/content/default_gitignore.rb +5 -5
- data/lib/makit/content/default_rakefile.rb +11 -11
- data/lib/makit/content/gem_rakefile.rb +14 -14
- data/lib/makit/data.rb +50 -50
- data/lib/makit/directories.rb +140 -140
- data/lib/makit/directory.rb +200 -200
- data/lib/makit/dotnet.rb +162 -163
- data/lib/makit/environment.rb +127 -127
- data/lib/makit/fileinfo.rb +16 -16
- data/lib/makit/files.rb +47 -47
- data/lib/makit/git.rb +87 -87
- data/lib/makit/gitlab_runner.rb +60 -60
- data/lib/makit/humanize.rb +129 -129
- data/lib/makit/indexer.rb +56 -56
- data/lib/makit/logging.rb +96 -96
- data/lib/makit/markdown.rb +75 -75
- data/lib/makit/mp/basic_object_mp.rb +16 -16
- data/lib/makit/mp/command_request.mp.rb +16 -16
- data/lib/makit/mp/project_mp.rb +210 -210
- data/lib/makit/mp/string_mp.rb +122 -140
- data/lib/makit/nuget.rb +57 -57
- data/lib/makit/protoc.rb +104 -104
- data/lib/makit/serializer.rb +115 -115
- data/lib/makit/show.rb +108 -108
- data/lib/makit/storage.rb +131 -131
- data/lib/makit/symbols.rb +149 -149
- data/lib/makit/tasks.rb +60 -61
- data/lib/makit/tree.rb +37 -37
- data/lib/makit/v1/makit.v1_pb.rb +34 -34
- data/lib/makit/v1/makit.v1_services_pb.rb +25 -25
- data/lib/makit/version.rb +52 -52
- data/lib/makit/wix.rb +95 -95
- data/lib/makit/zip.rb +17 -17
- data/lib/makit.rb +267 -267
- metadata +2 -4
- data/lib/generated/makit/v1/makit.v1_pb.rb +0 -34
- data/lib/generated/makit/v1/web/link_pb.rb +0 -20
data/lib/makit/mp/project_mp.rb
CHANGED
@@ -1,210 +1,210 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require "json"
|
3
|
-
require "yaml"
|
4
|
-
|
5
|
-
module Makit
|
6
|
-
module V1
|
7
|
-
class Project
|
8
|
-
#def to_yaml
|
9
|
-
# data = JSON.parse(self.to_pretty_json)
|
10
|
-
# data.to_yaml.sub(/^---\n/, "")
|
11
|
-
#end
|
12
|
-
|
13
|
-
def self.create
|
14
|
-
project = Makit::V1::Project.new
|
15
|
-
project.set_default_values
|
16
|
-
project
|
17
|
-
end
|
18
|
-
|
19
|
-
def open(filename)
|
20
|
-
other = Makit::Serializer.open(filename, Makit::V1::Project)
|
21
|
-
#other = Makit::V1::Project::create_from_file(filename)
|
22
|
-
self.name = other.name
|
23
|
-
self.git_remote_url = other.git_remote_url
|
24
|
-
self.dotnet_projects = other.dotnet_projects
|
25
|
-
self.artifacts = other.artifacts
|
26
|
-
end
|
27
|
-
|
28
|
-
#def self.create_from_file(filename)
|
29
|
-
# extension = File.extname(filename)
|
30
|
-
# case extension
|
31
|
-
# when ".yml"
|
32
|
-
# yaml = File.read(filename)
|
33
|
-
# create_from_yaml(yaml)
|
34
|
-
# when ".json"
|
35
|
-
# json = File.read(filename)
|
36
|
-
# create_from_json(json)
|
37
|
-
# else
|
38
|
-
# raise "unsupported file extension: #{extension}"
|
39
|
-
# end
|
40
|
-
#end
|
41
|
-
|
42
|
-
#def self.create_from_yaml(yaml)
|
43
|
-
# json = JSON.pretty_generate(YAML.load(yaml))
|
44
|
-
# project = Makit::V1::Project.decode_json(json)
|
45
|
-
# project
|
46
|
-
#end
|
47
|
-
|
48
|
-
#def self.create_from_json(json)
|
49
|
-
# project = Makit::V1::Project.decode_json(json)
|
50
|
-
# project
|
51
|
-
#end
|
52
|
-
|
53
|
-
def set_default_values
|
54
|
-
#self.language = "csharp"
|
55
|
-
#self.primary_artifact_type = "nuget"
|
56
|
-
if self.git_remote_url.nil? || self.git_remote_url.empty?
|
57
|
-
self.git_remote_url = `git remote get-url origin`.strip
|
58
|
-
end
|
59
|
-
if self.name.nil? || self.name.empty?
|
60
|
-
if (!self.git_remote_url.nil? && !self.git_remote_url.empty?)
|
61
|
-
self.name = get_name(File.basename(self.git_remote_url, ".git")) # get_capitalized_name(File.basename(self.git_remote_url, ".git"))
|
62
|
-
else
|
63
|
-
self.name = get_name(File.basename(Dir.getwd)) # get_capitalized_name(File.basename(Dir.getwd))
|
64
|
-
end
|
65
|
-
end
|
66
|
-
self
|
67
|
-
end
|
68
|
-
|
69
|
-
def get_name(name)
|
70
|
-
if !self.git_remote_url.nil? && !self.git_remote_url.empty?
|
71
|
-
is_dotnet = self.git_remote_url.include?("nuget")
|
72
|
-
if is_dotnet
|
73
|
-
get_capitalized_name(name)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
name.downcase
|
77
|
-
end
|
78
|
-
|
79
|
-
def get_capitalized_name(name)
|
80
|
-
name.split(".").map(&:capitalize).join(".")
|
81
|
-
end
|
82
|
-
|
83
|
-
def save_as(filename)
|
84
|
-
Makit::Serializer.save_as(filename, self)
|
85
|
-
#extension = File.extname(filename)
|
86
|
-
#case extension
|
87
|
-
#when ".json"
|
88
|
-
# File.write(filename, self.to_pretty_json)
|
89
|
-
#when ".yml"
|
90
|
-
# File.write(filename, self.to_yaml)
|
91
|
-
#else
|
92
|
-
# raise "unsupported file extension: #{extension}"
|
93
|
-
#end
|
94
|
-
end
|
95
|
-
|
96
|
-
def with_dotnet_project(template, name, output)
|
97
|
-
if !self.dotnet_projects.any? { |project| project.output == output }
|
98
|
-
project = Makit::V1::DotNetProject.new
|
99
|
-
project.template = template
|
100
|
-
project.name = name
|
101
|
-
project.output = output
|
102
|
-
self.dotnet_projects << project
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def setup
|
107
|
-
setup_dotnet_projects
|
108
|
-
end
|
109
|
-
|
110
|
-
def make
|
111
|
-
setup_dotnet_projects
|
112
|
-
make_dotnet_projects
|
113
|
-
|
114
|
-
# verify the artifacts exist
|
115
|
-
self.artifacts.each do |artifact|
|
116
|
-
raise "artifact does not exist: #{artifact}" if !File.exist?(artifact)
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
def build
|
121
|
-
build_dotnet_projects
|
122
|
-
end
|
123
|
-
|
124
|
-
def test
|
125
|
-
test_dotnet_projects
|
126
|
-
end
|
127
|
-
|
128
|
-
def setup_dotnet_projects
|
129
|
-
if self.dotnet_projects.any?
|
130
|
-
if (!File.exist?("#{self.name}.sln"))
|
131
|
-
puts " Creating solution file: " + "#{self.name}.sln".colorize(:green)
|
132
|
-
"dotnet new sln -n #{self.name}".run unless File.exist?("#{self.name}.sln")
|
133
|
-
else
|
134
|
-
#puts " Solution file already exists: " + "#{self.name}.sln".colorize(:yellow)
|
135
|
-
end
|
136
|
-
self.dotnet_projects.each do |project|
|
137
|
-
add_project = true
|
138
|
-
if (project.os == "windows" && !Makit::Environment.is_windows?)
|
139
|
-
add_project = false
|
140
|
-
end
|
141
|
-
if (add_project)
|
142
|
-
Makit::DotNet.new_project(project.template, project.name, project.output)
|
143
|
-
# add any nuget packages to the project
|
144
|
-
project_filename = "#{project.output}/#{project.name}.csproj"
|
145
|
-
project.packages.each { |package|
|
146
|
-
Makit::DotNet::add_package(project_filename, package)
|
147
|
-
}
|
148
|
-
end
|
149
|
-
end
|
150
|
-
#Makit::DotNet.new_solution(self.name)
|
151
|
-
Makit::DotNet.sln_add_projects(self.name)
|
152
|
-
else
|
153
|
-
#puts " no dotnet projects found".colorize(:yellow)
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
def make_dotnet_projects
|
158
|
-
self.dotnet_projects.each do |project|
|
159
|
-
if (project.os == "windows" && !Makit::Environment.is_windows?)
|
160
|
-
next
|
161
|
-
else
|
162
|
-
project.commands.each do |command|
|
163
|
-
newest_file_timestamp = Makit::Directory::get_newest_file_timestamp(project.output)
|
164
|
-
#newest_file = Makit::Directory::get_newest_file_or_now(project.output)
|
165
|
-
command_request = Makit::RUNNER::parse_command_request(command)
|
166
|
-
RUNNER.cache_run(command_request, newest_file_timestamp)
|
167
|
-
end
|
168
|
-
end
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
def build_dotnet_projects
|
173
|
-
self.dotnet_projects.each do |project|
|
174
|
-
if (project.os == "windows" && !Makit::Environment.is_windows?)
|
175
|
-
next
|
176
|
-
else
|
177
|
-
project.commands.each do |command|
|
178
|
-
newest_file_timestamp = Makit::Directory::get_newest_file_timestamp(project.output)
|
179
|
-
#newest_file = Makit::Directory::get_newest_file_or_now(project.output)
|
180
|
-
command_request = Makit::RUNNER::parse_command_request(command)
|
181
|
-
RUNNER.cache_run(command_request, newest_file_timestamp)
|
182
|
-
end
|
183
|
-
project.build_args.each do |build_arg|
|
184
|
-
project_path = File.join(project.output, "#{project.name}.csproj")
|
185
|
-
Makit::DotNet.build(project_path, build_arg.configuration, build_arg.output)
|
186
|
-
end
|
187
|
-
project.publish_args.each do |publish_arg|
|
188
|
-
project_path = File.join(project.output, "#{project.name}.csproj")
|
189
|
-
Makit::DotNet.publish(project_path, publish_arg.configuration, publish_arg.output)
|
190
|
-
end
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
def test_dotnet_projects
|
196
|
-
self.dotnet_projects.each do |project|
|
197
|
-
if (project.os == "windows" && !Makit::Environment.is_windows?)
|
198
|
-
next
|
199
|
-
else
|
200
|
-
project.test_args.each do |test_args|
|
201
|
-
project_path = File.join(project.output, "#{project.name}.csproj")
|
202
|
-
Makit::DotNet.test(project_path, test_args.configuration, test_args.output)
|
203
|
-
end
|
204
|
-
#"dotnet test #{project.output} --configuration Release".run
|
205
|
-
end
|
206
|
-
end
|
207
|
-
end
|
208
|
-
end # class Project
|
209
|
-
end # module V1
|
210
|
-
end # module Makit
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "json"
|
3
|
+
require "yaml"
|
4
|
+
|
5
|
+
module Makit
|
6
|
+
module V1
|
7
|
+
class Project
|
8
|
+
#def to_yaml
|
9
|
+
# data = JSON.parse(self.to_pretty_json)
|
10
|
+
# data.to_yaml.sub(/^---\n/, "")
|
11
|
+
#end
|
12
|
+
|
13
|
+
def self.create
|
14
|
+
project = Makit::V1::Project.new
|
15
|
+
project.set_default_values
|
16
|
+
project
|
17
|
+
end
|
18
|
+
|
19
|
+
def open(filename)
|
20
|
+
other = Makit::Serializer.open(filename, Makit::V1::Project)
|
21
|
+
#other = Makit::V1::Project::create_from_file(filename)
|
22
|
+
self.name = other.name
|
23
|
+
self.git_remote_url = other.git_remote_url
|
24
|
+
self.dotnet_projects = other.dotnet_projects
|
25
|
+
self.artifacts = other.artifacts
|
26
|
+
end
|
27
|
+
|
28
|
+
#def self.create_from_file(filename)
|
29
|
+
# extension = File.extname(filename)
|
30
|
+
# case extension
|
31
|
+
# when ".yml"
|
32
|
+
# yaml = File.read(filename)
|
33
|
+
# create_from_yaml(yaml)
|
34
|
+
# when ".json"
|
35
|
+
# json = File.read(filename)
|
36
|
+
# create_from_json(json)
|
37
|
+
# else
|
38
|
+
# raise "unsupported file extension: #{extension}"
|
39
|
+
# end
|
40
|
+
#end
|
41
|
+
|
42
|
+
#def self.create_from_yaml(yaml)
|
43
|
+
# json = JSON.pretty_generate(YAML.load(yaml))
|
44
|
+
# project = Makit::V1::Project.decode_json(json)
|
45
|
+
# project
|
46
|
+
#end
|
47
|
+
|
48
|
+
#def self.create_from_json(json)
|
49
|
+
# project = Makit::V1::Project.decode_json(json)
|
50
|
+
# project
|
51
|
+
#end
|
52
|
+
|
53
|
+
def set_default_values
|
54
|
+
#self.language = "csharp"
|
55
|
+
#self.primary_artifact_type = "nuget"
|
56
|
+
if self.git_remote_url.nil? || self.git_remote_url.empty?
|
57
|
+
self.git_remote_url = `git remote get-url origin`.strip
|
58
|
+
end
|
59
|
+
if self.name.nil? || self.name.empty?
|
60
|
+
if (!self.git_remote_url.nil? && !self.git_remote_url.empty?)
|
61
|
+
self.name = get_name(File.basename(self.git_remote_url, ".git")) # get_capitalized_name(File.basename(self.git_remote_url, ".git"))
|
62
|
+
else
|
63
|
+
self.name = get_name(File.basename(Dir.getwd)) # get_capitalized_name(File.basename(Dir.getwd))
|
64
|
+
end
|
65
|
+
end
|
66
|
+
self
|
67
|
+
end
|
68
|
+
|
69
|
+
def get_name(name)
|
70
|
+
if !self.git_remote_url.nil? && !self.git_remote_url.empty?
|
71
|
+
is_dotnet = self.git_remote_url.include?("nuget")
|
72
|
+
if is_dotnet
|
73
|
+
get_capitalized_name(name)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
name.downcase
|
77
|
+
end
|
78
|
+
|
79
|
+
def get_capitalized_name(name)
|
80
|
+
name.split(".").map(&:capitalize).join(".")
|
81
|
+
end
|
82
|
+
|
83
|
+
def save_as(filename)
|
84
|
+
Makit::Serializer.save_as(filename, self)
|
85
|
+
#extension = File.extname(filename)
|
86
|
+
#case extension
|
87
|
+
#when ".json"
|
88
|
+
# File.write(filename, self.to_pretty_json)
|
89
|
+
#when ".yml"
|
90
|
+
# File.write(filename, self.to_yaml)
|
91
|
+
#else
|
92
|
+
# raise "unsupported file extension: #{extension}"
|
93
|
+
#end
|
94
|
+
end
|
95
|
+
|
96
|
+
def with_dotnet_project(template, name, output)
|
97
|
+
if !self.dotnet_projects.any? { |project| project.output == output }
|
98
|
+
project = Makit::V1::DotNetProject.new
|
99
|
+
project.template = template
|
100
|
+
project.name = name
|
101
|
+
project.output = output
|
102
|
+
self.dotnet_projects << project
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def setup
|
107
|
+
setup_dotnet_projects
|
108
|
+
end
|
109
|
+
|
110
|
+
def make
|
111
|
+
setup_dotnet_projects
|
112
|
+
make_dotnet_projects
|
113
|
+
|
114
|
+
# verify the artifacts exist
|
115
|
+
self.artifacts.each do |artifact|
|
116
|
+
raise "artifact does not exist: #{artifact}" if !File.exist?(artifact)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def build
|
121
|
+
build_dotnet_projects
|
122
|
+
end
|
123
|
+
|
124
|
+
def test
|
125
|
+
test_dotnet_projects
|
126
|
+
end
|
127
|
+
|
128
|
+
def setup_dotnet_projects
|
129
|
+
if self.dotnet_projects.any?
|
130
|
+
if (!File.exist?("#{self.name}.sln"))
|
131
|
+
puts " Creating solution file: " + "#{self.name}.sln".colorize(:green)
|
132
|
+
"dotnet new sln -n #{self.name}".run unless File.exist?("#{self.name}.sln")
|
133
|
+
else
|
134
|
+
#puts " Solution file already exists: " + "#{self.name}.sln".colorize(:yellow)
|
135
|
+
end
|
136
|
+
self.dotnet_projects.each do |project|
|
137
|
+
add_project = true
|
138
|
+
if (project.os == "windows" && !Makit::Environment.is_windows?)
|
139
|
+
add_project = false
|
140
|
+
end
|
141
|
+
if (add_project)
|
142
|
+
Makit::DotNet.new_project(project.template, project.name, project.output)
|
143
|
+
# add any nuget packages to the project
|
144
|
+
project_filename = "#{project.output}/#{project.name}.csproj"
|
145
|
+
project.packages.each { |package|
|
146
|
+
Makit::DotNet::add_package(project_filename, package)
|
147
|
+
}
|
148
|
+
end
|
149
|
+
end
|
150
|
+
#Makit::DotNet.new_solution(self.name)
|
151
|
+
Makit::DotNet.sln_add_projects(self.name)
|
152
|
+
else
|
153
|
+
#puts " no dotnet projects found".colorize(:yellow)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
def make_dotnet_projects
|
158
|
+
self.dotnet_projects.each do |project|
|
159
|
+
if (project.os == "windows" && !Makit::Environment.is_windows?)
|
160
|
+
next
|
161
|
+
else
|
162
|
+
project.commands.each do |command|
|
163
|
+
newest_file_timestamp = Makit::Directory::get_newest_file_timestamp(project.output)
|
164
|
+
#newest_file = Makit::Directory::get_newest_file_or_now(project.output)
|
165
|
+
command_request = Makit::RUNNER::parse_command_request(command)
|
166
|
+
RUNNER.cache_run(command_request, newest_file_timestamp)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
def build_dotnet_projects
|
173
|
+
self.dotnet_projects.each do |project|
|
174
|
+
if (project.os == "windows" && !Makit::Environment.is_windows?)
|
175
|
+
next
|
176
|
+
else
|
177
|
+
project.commands.each do |command|
|
178
|
+
newest_file_timestamp = Makit::Directory::get_newest_file_timestamp(project.output)
|
179
|
+
#newest_file = Makit::Directory::get_newest_file_or_now(project.output)
|
180
|
+
command_request = Makit::RUNNER::parse_command_request(command)
|
181
|
+
RUNNER.cache_run(command_request, newest_file_timestamp)
|
182
|
+
end
|
183
|
+
project.build_args.each do |build_arg|
|
184
|
+
project_path = File.join(project.output, "#{project.name}.csproj")
|
185
|
+
Makit::DotNet.build(project_path, build_arg.configuration, build_arg.output)
|
186
|
+
end
|
187
|
+
project.publish_args.each do |publish_arg|
|
188
|
+
project_path = File.join(project.output, "#{project.name}.csproj")
|
189
|
+
Makit::DotNet.publish(project_path, publish_arg.configuration, publish_arg.output)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
def test_dotnet_projects
|
196
|
+
self.dotnet_projects.each do |project|
|
197
|
+
if (project.os == "windows" && !Makit::Environment.is_windows?)
|
198
|
+
next
|
199
|
+
else
|
200
|
+
project.test_args.each do |test_args|
|
201
|
+
project_path = File.join(project.output, "#{project.name}.csproj")
|
202
|
+
Makit::DotNet.test(project_path, test_args.configuration, test_args.output)
|
203
|
+
end
|
204
|
+
#"dotnet test #{project.output} --configuration Release".run
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end # class Project
|
209
|
+
end # module V1
|
210
|
+
end # module Makit
|