makit 0.0.34 → 0.0.36

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/lib/makit/apache.rb +32 -32
  3. data/lib/makit/cli/clean.rb +14 -14
  4. data/lib/makit/cli/clone.rb +59 -59
  5. data/lib/makit/cli/init.rb +38 -38
  6. data/lib/makit/cli/main.rb +33 -33
  7. data/lib/makit/cli/make.rb +54 -54
  8. data/lib/makit/cli/new.rb +37 -37
  9. data/lib/makit/cli/nuget_cache.rb +38 -38
  10. data/lib/makit/cli/pull.rb +31 -31
  11. data/lib/makit/cli/setup.rb +71 -71
  12. data/lib/makit/cli/work.rb +21 -21
  13. data/lib/makit/command_runner.rb +391 -353
  14. data/lib/makit/commands.rb +21 -21
  15. data/lib/makit/content/default_gitignore.rb +5 -5
  16. data/lib/makit/content/default_gitignore.txt +222 -222
  17. data/lib/makit/content/default_rakefile.rb +11 -11
  18. data/lib/makit/content/gem_rakefile.rb +14 -14
  19. data/lib/makit/data.rb +50 -50
  20. data/lib/makit/directories.rb +140 -140
  21. data/lib/makit/directory.rb +184 -184
  22. data/lib/makit/dotnet.rb +156 -134
  23. data/lib/makit/environment.rb +127 -127
  24. data/lib/makit/fileinfo.rb +16 -16
  25. data/lib/makit/files.rb +47 -47
  26. data/lib/makit/git.rb +86 -86
  27. data/lib/makit/gitlab_runner.rb +60 -60
  28. data/lib/makit/humanize.rb +112 -112
  29. data/lib/makit/indexer.rb +56 -0
  30. data/lib/makit/logging.rb +96 -96
  31. data/lib/makit/markdown.rb +75 -75
  32. data/lib/makit/mp/basic_object_mp.rb +16 -16
  33. data/lib/makit/mp/command_request.mp.rb +16 -16
  34. data/lib/makit/mp/project_mp.rb +210 -210
  35. data/lib/makit/mp/string_mp.rb +122 -122
  36. data/lib/makit/nuget.rb +57 -57
  37. data/lib/makit/protoc.rb +104 -104
  38. data/lib/makit/serializer.rb +115 -115
  39. data/lib/makit/show.rb +76 -77
  40. data/lib/makit/storage.rb +131 -131
  41. data/lib/makit/symbols.rb +149 -149
  42. data/lib/makit/tasks.rb +60 -60
  43. data/lib/makit/tree.rb +37 -37
  44. data/lib/makit/v1/makit.v1_pb.rb +4 -3
  45. data/lib/makit/v1/makit.v1_services_pb.rb +25 -25
  46. data/lib/makit/version.rb +12 -12
  47. data/lib/makit/wix.rb +95 -95
  48. data/lib/makit/zip.rb +17 -17
  49. data/lib/makit.rb +267 -267
  50. metadata +4 -5
  51. data/lib/generated/makit/v1/makit.v1_pb.rb +0 -34
  52. data/lib/generated/makit/v1/web/link_pb.rb +0 -20
data/lib/makit.rb CHANGED
@@ -1,267 +1,267 @@
1
- # frozen_string_literal: true
2
-
3
- require "rake/clean"
4
- require "logger"
5
- require "json"
6
- require "yaml"
7
- require "google/protobuf"
8
-
9
- #%w[generated/makit].each do |dir|
10
- # Dir[File.join(__dir__, dir, "*.rb")].each do |file|
11
- # require_relative file
12
- # end
13
- #end
14
- if (File.exist?("protos/makit/makit.v1.proto.rb"))
15
- require_relative "generated/makit/makit.v1_pb"
16
- else
17
- require_relative "makit/v1/makit.v1_pb"
18
- end
19
-
20
- #%w[makit makit/v1 makit/cli makit/content makit/mp].each do |dir|
21
- %w[makit makit/cli makit/content makit/mp].each do |dir|
22
- Dir[File.join(__dir__, dir, "*.rb")].each do |file|
23
- require_relative file
24
- end
25
- end
26
-
27
- module Makit
28
- class Error < StandardError; end
29
-
30
- # Constants
31
- if File.exist? ".makit.project.json"
32
- PROJECT = Makit::Serializer.open(".makit.project.json", Makit::V1::Project)
33
- else
34
- if File.exist? ".makit.project.yml"
35
- PROJECT = Makit::Serializer.open(".makit.project.yml", Makit::V1::Project)
36
- else
37
- PROJECT = Makit::V1::Project.new
38
- PROJECT.set_default_values
39
- end
40
- end
41
-
42
- STARTTIME = Time.now
43
- SHOW = Makit::Show.new
44
- IS_GIT_REPO = Dir.exist? ".git"
45
- DETACHED = `git status`.include?("detached")
46
- IS_READ_ONLY = !IS_GIT_REPO || DETACHED
47
- RUNTIME_IDENTIFIER = Makit::Environment::get_runtime_identifier
48
- DEVICE = Socket.gethostname
49
- LOGGER = Makit::Logging::MultiLogger.create_logger
50
-
51
- # Git Commit and Branch/Tag constants
52
- ENV["COMMIT_SHA"] = Makit::Git::commitsha
53
- ENV["COMMIT_BRANCH"] = Makit::Git::branch
54
-
55
- RUNNER = CommandRunner.new
56
- GIT_FILE_INFOS = Makit::Git::get_file_infos
57
- #RUNNER.log_to_artifacts = true
58
- # Variables
59
- log_level = Logger::INFO
60
- package_type = Makit::V1::PackageType::GEM
61
- commands = Makit::Commands.new
62
-
63
- # methods
64
- #
65
- # initialize a git repository
66
- def self.init(directory)
67
- if !Dir.exist?(directory)
68
- FileUtils.mkdir_p(directory)
69
- end
70
- raise Makit::Error.new("directory does not exist: #{directory}") if !Dir.exist?(directory)
71
- Dir.chdir(directory) do
72
- File.write(".gitignore", Makit::Content::GITIGNORE) unless File.exist?(".gitignore")
73
- init = Makit::RUNNER.execute "git init"
74
- if init.exit_code != 0
75
- raise Makit::Error.new("failed to initialize local repository: #{directory}\n#{Makit::Humanize.get_command_summary(init)}")
76
- end
77
- init
78
- end
79
- end
80
-
81
- # clone a git repository to a local directory in Directories::CLONE
82
- # returns the Makit::V1::Command for 'git clone ...'
83
- def self.clone(git_repository)
84
- commands = []
85
- # make sure a local clone of the repository exists
86
- clone_dir = Directories::get_clone_directory(git_repository)
87
- if (!Dir.exist?(clone_dir))
88
- commands << Makit::RUNNER.execute("git clone #{git_repository} #{clone_dir}")
89
- end
90
- commands
91
- end
92
-
93
- # pull the latest changes from the remote repository to a local clone in Directories::CLONE
94
- def self.pull(git_repository)
95
- clone_dir = Directories::get_clone_directory(git_repository)
96
- raise Makit::Error.new("clone directory does not exist: #{clone_dir}") if !Dir.exist?(clone_dir)
97
- Dir.chdir(clone_dir) do
98
- request = Makit::V1::CommandRequest.new(
99
- name: "git",
100
- arguments: ["pull"],
101
- directory: clone_dir,
102
- )
103
- pull_command = Makit::RUNNER.execute(request)
104
- raise Makit::Error.new(Makit::Humanize::get_command_details(pull_command)) if pull_command.exit_code != 0
105
- return pull_command
106
- end
107
- end
108
-
109
- def self.clone_or_pull(git_repository)
110
- commands = []
111
- clone_dir = Directories::get_clone_directory(git_repository)
112
- if Dir.exist?(clone_dir)
113
- commands << pull(git_repository)
114
- else
115
- commands << clone(git_repository)
116
- end
117
- commands
118
- end
119
-
120
- # log information about a specific repository
121
- # return an array of GitLogEntry objects
122
- def self.log(git_repository, limit, skip)
123
- entries = []
124
- clone_dir = Directories::get_clone_directory(git_repository)
125
- raise Makit::Error.new("clone directory does not exist: #{clone_dir}") if !Dir.exist?(clone_dir)
126
- Dir.chdir(clone_dir) do
127
- log_command = Makit::RUNNER.execute("git log -n #{limit} --skip #{skip} --date=iso")
128
- if log_command.exit_code != 0
129
- lines = log_command.stderr.split("\n")
130
- # iterate over the lines, generating a GitLogEntry for each commit
131
- lines.each do |line|
132
- if line.start_with?("commit")
133
- commit = line.split(" ")[1]
134
- entries << GitLogEntry.new(commit)
135
- end
136
- if line.start_with?("Author:")
137
- entries.last.author = line.split(" ")[1..-1].join(" ")
138
- end
139
- if line.start_with?("Date:")
140
- entries.last.date = line.split(" ")[1..-1].join(" ")
141
- end
142
- if line.start_with?(" ")
143
- entries.last.message += line[4..-1]
144
- end
145
- end
146
- end
147
- end
148
- entries
149
- end
150
-
151
- # work on a local clone of a git repository
152
- # if the repository does not exist, clone it
153
- # if the repository exists, pull the latest changes
154
- # if a build command can be found, execute it and return the result Makit::V1::WorkResult
155
- def self.work(repository)
156
- commands = []
157
- work_dir = Makit::Directories::get_work_directory(repository)
158
- commands << clone_or_pull(repository)
159
- clone_dir = Makit::Directories::get_clone_directory(repository)
160
- if !Dir.exist?(work_dir)
161
- # make the parent directory for work_dir if it does not exist
162
- FileUtils.mkdir_p(File.dirname(work_dir)) unless Dir.exist?(File.dirname(work_dir))
163
- Makit::RUNNER::execute "git clone #{clone_dir} #{work_dir}"
164
- end
165
- Dir.chdir(work_dir) do
166
- # if there is no .gitignore file, create one
167
- File.write(".gitignore", Makit::Content::GITIGNORE) unless File.exist?(".gitignore")
168
- end
169
- nil?
170
- end
171
-
172
- def self.enable_monkey_patch
173
- %w[makit/mp].each do |dir|
174
- Dir[File.join(__dir__, dir, "*.rb")].each do |file|
175
- require_relative file
176
- end
177
- end
178
- end
179
- # Given a git repository URL and a commit id, create a new MakeResult object.
180
- def self.make(url, commit, force = false)
181
- log_filename = File.join(Directories::get_log_directory(url), commit, +"#{RUNTIME_IDENTIFIER}.#{DEVICE}.json")
182
- if File.exist?(log_filename) && !force && commit != "latest"
183
- begin
184
- # deserialize the log file to a Makite::V1::MakeResult object
185
- make_result = Makit::V1::MakeResult.decode_json(File.read(log_filename))
186
- return make_result
187
- rescue => e
188
- # if deserialization fails, delete the log file and continue
189
- FileUtils.rm(log_filename)
190
- end
191
- else
192
- commands = []
193
- begin
194
- clone_or_pull(url).each do |command|
195
- commands << command
196
- end
197
- # make sure a local clone of the repository exists
198
- clone_dir = Directories::get_clone_directory(url)
199
- raise Makit::Error.new("clone directory does not exist: #{clone_dir}") if !Dir.exist?(clone_dir)
200
-
201
- if (commit == "latest")
202
- Dir.chdir(clone_dir) do
203
- git_log = Makit::RUNNER.execute("git log -n 1 --date=iso")
204
-
205
- commands << git_log
206
- # assert that the commit is valid
207
- commit = git_log.output.match(/^commit ([0-9a-f]{40})$/i)[1]
208
- raise Makit::Error.new("invalid commit: #{commit}") if commit.nil? || commit.empty? || !commit.match?(/\A[0-9a-f]{40}\z/i)
209
- log_filename = File.join(Directories::get_log_directory(url), commit, +"#{RUNTIME_IDENTIFIER}.#{DEVICE}.json")
210
- end
211
- end
212
-
213
- # clone a fresh copy of the repository to a make directory
214
- make_dir = Directories::get_make_commit_directory(url, commit)
215
- FileUtils.rm_rf(make_dir) if Dir.exist?(make_dir)
216
- commands << Makit::RUNNER.execute("git clone #{clone_dir} #{make_dir}")
217
- raise Makit::Error.new("failed to clone repository: #{url} to #{make_dir}") if !Dir.exist?(make_dir)
218
- Dir.chdir(make_dir) do
219
- commands << Makit::RUNNER.execute("git reset --hard #{commit}")
220
- commands << Makit::RUNNER.execute("git log -n 1")
221
-
222
- commands << Makit::RUNNER.execute("bundle install") if File.exist? "Gemfile"
223
- if File.exist? ("Rakefile")
224
- commands << Makit::RUNNER.execute("rake default")
225
- else
226
- commands << Makit::RUNNER.execute("rake default") if File.exist? "rakefile.rb"
227
- end
228
-
229
- make_result = Makit::V1::MakeResult.new(
230
- repository: url,
231
- commit: commit,
232
- branch: "?",
233
- tag: "?",
234
- device: DEVICE,
235
- runtime_identifier: RUNTIME_IDENTIFIER,
236
- )
237
- commands.flatten.each do |command|
238
- make_result.commands << command
239
- end
240
-
241
- # save the MakeResult object to a log file as pretty printed json
242
- FileUtils.mkdir_p(File.dirname(log_filename)) unless Dir.exist?(File.dirname(log_filename))
243
- File.write(log_filename, make_result.to_json)
244
-
245
- return make_result
246
- end
247
- rescue => e
248
- message = "error raised attempting to make repository: #{url} commit: #{commit}\n\n"
249
- message += "#{e.message}\n"
250
- backtrace = e.backtrace.join("\n")
251
- message += "#{backtrace}\n\n"
252
- message += "commands:\n"
253
- commands.flatten.each do |command|
254
- message += Makit::Humanize::get_command_details(command)
255
- end
256
- raise Makit::Error.new(message)
257
- end
258
- end
259
- end
260
- end
261
-
262
- if !File.exist?(".gitignore")
263
- Makit::LOGGER.info("added .gitignore file")
264
- File.open(".gitignore", "w") do |file|
265
- file.puts Makit::Content::GITIGNORE
266
- end
267
- end
1
+ # frozen_string_literal: true
2
+
3
+ require "rake/clean"
4
+ require "logger"
5
+ require "json"
6
+ require "yaml"
7
+ require "google/protobuf"
8
+
9
+ #%w[generated/makit].each do |dir|
10
+ # Dir[File.join(__dir__, dir, "*.rb")].each do |file|
11
+ # require_relative file
12
+ # end
13
+ #end
14
+ if (File.exist?("protos/makit/makit.v1.proto.rb"))
15
+ require_relative "generated/makit/makit.v1_pb"
16
+ else
17
+ require_relative "makit/v1/makit.v1_pb"
18
+ end
19
+
20
+ #%w[makit makit/v1 makit/cli makit/content makit/mp].each do |dir|
21
+ %w[makit makit/cli makit/content makit/mp].each do |dir|
22
+ Dir[File.join(__dir__, dir, "*.rb")].each do |file|
23
+ require_relative file
24
+ end
25
+ end
26
+
27
+ module Makit
28
+ class Error < StandardError; end
29
+
30
+ # Constants
31
+ if File.exist? ".makit.project.json"
32
+ PROJECT = Makit::Serializer.open(".makit.project.json", Makit::V1::Project)
33
+ else
34
+ if File.exist? ".makit.project.yml"
35
+ PROJECT = Makit::Serializer.open(".makit.project.yml", Makit::V1::Project)
36
+ else
37
+ PROJECT = Makit::V1::Project.new
38
+ PROJECT.set_default_values
39
+ end
40
+ end
41
+
42
+ STARTTIME = Time.now
43
+ SHOW = Makit::Show.new
44
+ IS_GIT_REPO = Dir.exist? ".git"
45
+ DETACHED = `git status`.include?("detached")
46
+ IS_READ_ONLY = !IS_GIT_REPO || DETACHED
47
+ RUNTIME_IDENTIFIER = Makit::Environment::get_runtime_identifier
48
+ DEVICE = Socket.gethostname
49
+ LOGGER = Makit::Logging::MultiLogger.create_logger
50
+
51
+ # Git Commit and Branch/Tag constants
52
+ ENV["COMMIT_SHA"] = Makit::Git::commitsha
53
+ ENV["COMMIT_BRANCH"] = Makit::Git::branch
54
+
55
+ RUNNER = CommandRunner.new
56
+ GIT_FILE_INFOS = Makit::Git::get_file_infos
57
+ #RUNNER.log_to_artifacts = true
58
+ # Variables
59
+ log_level = Logger::INFO
60
+ package_type = Makit::V1::PackageType::GEM
61
+ commands = Makit::Commands.new
62
+
63
+ # methods
64
+ #
65
+ # initialize a git repository
66
+ def self.init(directory)
67
+ if !Dir.exist?(directory)
68
+ FileUtils.mkdir_p(directory)
69
+ end
70
+ raise Makit::Error.new("directory does not exist: #{directory}") if !Dir.exist?(directory)
71
+ Dir.chdir(directory) do
72
+ File.write(".gitignore", Makit::Content::GITIGNORE) unless File.exist?(".gitignore")
73
+ init = Makit::RUNNER.execute "git init"
74
+ if init.exit_code != 0
75
+ raise Makit::Error.new("failed to initialize local repository: #{directory}\n#{Makit::Humanize.get_command_summary(init)}")
76
+ end
77
+ init
78
+ end
79
+ end
80
+
81
+ # clone a git repository to a local directory in Directories::CLONE
82
+ # returns the Makit::V1::Command for 'git clone ...'
83
+ def self.clone(git_repository)
84
+ commands = []
85
+ # make sure a local clone of the repository exists
86
+ clone_dir = Directories::get_clone_directory(git_repository)
87
+ if (!Dir.exist?(clone_dir))
88
+ commands << Makit::RUNNER.execute("git clone #{git_repository} #{clone_dir}")
89
+ end
90
+ commands
91
+ end
92
+
93
+ # pull the latest changes from the remote repository to a local clone in Directories::CLONE
94
+ def self.pull(git_repository)
95
+ clone_dir = Directories::get_clone_directory(git_repository)
96
+ raise Makit::Error.new("clone directory does not exist: #{clone_dir}") if !Dir.exist?(clone_dir)
97
+ Dir.chdir(clone_dir) do
98
+ request = Makit::V1::CommandRequest.new(
99
+ name: "git",
100
+ arguments: ["pull"],
101
+ directory: clone_dir,
102
+ )
103
+ pull_command = Makit::RUNNER.execute(request)
104
+ raise Makit::Error.new(Makit::Humanize::get_command_details(pull_command)) if pull_command.exit_code != 0
105
+ return pull_command
106
+ end
107
+ end
108
+
109
+ def self.clone_or_pull(git_repository)
110
+ commands = []
111
+ clone_dir = Directories::get_clone_directory(git_repository)
112
+ if Dir.exist?(clone_dir)
113
+ commands << pull(git_repository)
114
+ else
115
+ commands << clone(git_repository)
116
+ end
117
+ commands
118
+ end
119
+
120
+ # log information about a specific repository
121
+ # return an array of GitLogEntry objects
122
+ def self.log(git_repository, limit, skip)
123
+ entries = []
124
+ clone_dir = Directories::get_clone_directory(git_repository)
125
+ raise Makit::Error.new("clone directory does not exist: #{clone_dir}") if !Dir.exist?(clone_dir)
126
+ Dir.chdir(clone_dir) do
127
+ log_command = Makit::RUNNER.execute("git log -n #{limit} --skip #{skip} --date=iso")
128
+ if log_command.exit_code != 0
129
+ lines = log_command.stderr.split("\n")
130
+ # iterate over the lines, generating a GitLogEntry for each commit
131
+ lines.each do |line|
132
+ if line.start_with?("commit")
133
+ commit = line.split(" ")[1]
134
+ entries << GitLogEntry.new(commit)
135
+ end
136
+ if line.start_with?("Author:")
137
+ entries.last.author = line.split(" ")[1..-1].join(" ")
138
+ end
139
+ if line.start_with?("Date:")
140
+ entries.last.date = line.split(" ")[1..-1].join(" ")
141
+ end
142
+ if line.start_with?(" ")
143
+ entries.last.message += line[4..-1]
144
+ end
145
+ end
146
+ end
147
+ end
148
+ entries
149
+ end
150
+
151
+ # work on a local clone of a git repository
152
+ # if the repository does not exist, clone it
153
+ # if the repository exists, pull the latest changes
154
+ # if a build command can be found, execute it and return the result Makit::V1::WorkResult
155
+ def self.work(repository)
156
+ commands = []
157
+ work_dir = Makit::Directories::get_work_directory(repository)
158
+ commands << clone_or_pull(repository)
159
+ clone_dir = Makit::Directories::get_clone_directory(repository)
160
+ if !Dir.exist?(work_dir)
161
+ # make the parent directory for work_dir if it does not exist
162
+ FileUtils.mkdir_p(File.dirname(work_dir)) unless Dir.exist?(File.dirname(work_dir))
163
+ Makit::RUNNER::execute "git clone #{clone_dir} #{work_dir}"
164
+ end
165
+ Dir.chdir(work_dir) do
166
+ # if there is no .gitignore file, create one
167
+ File.write(".gitignore", Makit::Content::GITIGNORE) unless File.exist?(".gitignore")
168
+ end
169
+ nil?
170
+ end
171
+
172
+ def self.enable_monkey_patch
173
+ %w[makit/mp].each do |dir|
174
+ Dir[File.join(__dir__, dir, "*.rb")].each do |file|
175
+ require_relative file
176
+ end
177
+ end
178
+ end
179
+ # Given a git repository URL and a commit id, create a new MakeResult object.
180
+ def self.make(url, commit, force = false)
181
+ log_filename = File.join(Directories::get_log_directory(url), commit, +"#{RUNTIME_IDENTIFIER}.#{DEVICE}.json")
182
+ if File.exist?(log_filename) && !force && commit != "latest"
183
+ begin
184
+ # deserialize the log file to a Makite::V1::MakeResult object
185
+ make_result = Makit::V1::MakeResult.decode_json(File.read(log_filename))
186
+ return make_result
187
+ rescue => e
188
+ # if deserialization fails, delete the log file and continue
189
+ FileUtils.rm(log_filename)
190
+ end
191
+ else
192
+ commands = []
193
+ begin
194
+ clone_or_pull(url).each do |command|
195
+ commands << command
196
+ end
197
+ # make sure a local clone of the repository exists
198
+ clone_dir = Directories::get_clone_directory(url)
199
+ raise Makit::Error.new("clone directory does not exist: #{clone_dir}") if !Dir.exist?(clone_dir)
200
+
201
+ if (commit == "latest")
202
+ Dir.chdir(clone_dir) do
203
+ git_log = Makit::RUNNER.execute("git log -n 1 --date=iso")
204
+
205
+ commands << git_log
206
+ # assert that the commit is valid
207
+ commit = git_log.output.match(/^commit ([0-9a-f]{40})$/i)[1]
208
+ raise Makit::Error.new("invalid commit: #{commit}") if commit.nil? || commit.empty? || !commit.match?(/\A[0-9a-f]{40}\z/i)
209
+ log_filename = File.join(Directories::get_log_directory(url), commit, +"#{RUNTIME_IDENTIFIER}.#{DEVICE}.json")
210
+ end
211
+ end
212
+
213
+ # clone a fresh copy of the repository to a make directory
214
+ make_dir = Directories::get_make_commit_directory(url, commit)
215
+ FileUtils.rm_rf(make_dir) if Dir.exist?(make_dir)
216
+ commands << Makit::RUNNER.execute("git clone #{clone_dir} #{make_dir}")
217
+ raise Makit::Error.new("failed to clone repository: #{url} to #{make_dir}") if !Dir.exist?(make_dir)
218
+ Dir.chdir(make_dir) do
219
+ commands << Makit::RUNNER.execute("git reset --hard #{commit}")
220
+ commands << Makit::RUNNER.execute("git log -n 1")
221
+
222
+ commands << Makit::RUNNER.execute("bundle install") if File.exist? "Gemfile"
223
+ if File.exist? ("Rakefile")
224
+ commands << Makit::RUNNER.execute("rake default")
225
+ else
226
+ commands << Makit::RUNNER.execute("rake default") if File.exist? "rakefile.rb"
227
+ end
228
+
229
+ make_result = Makit::V1::MakeResult.new(
230
+ repository: url,
231
+ commit: commit,
232
+ branch: "?",
233
+ tag: "?",
234
+ device: DEVICE,
235
+ runtime_identifier: RUNTIME_IDENTIFIER,
236
+ )
237
+ commands.flatten.each do |command|
238
+ make_result.commands << command
239
+ end
240
+
241
+ # save the MakeResult object to a log file as pretty printed json
242
+ FileUtils.mkdir_p(File.dirname(log_filename)) unless Dir.exist?(File.dirname(log_filename))
243
+ File.write(log_filename, make_result.to_json)
244
+
245
+ return make_result
246
+ end
247
+ rescue => e
248
+ message = "error raised attempting to make repository: #{url} commit: #{commit}\n\n"
249
+ message += "#{e.message}\n"
250
+ backtrace = e.backtrace.join("\n")
251
+ message += "#{backtrace}\n\n"
252
+ message += "commands:\n"
253
+ commands.flatten.each do |command|
254
+ message += Makit::Humanize::get_command_details(command)
255
+ end
256
+ raise Makit::Error.new(message)
257
+ end
258
+ end
259
+ end
260
+ end
261
+
262
+ if !File.exist?(".gitignore")
263
+ Makit::LOGGER.info("added .gitignore file")
264
+ File.open(".gitignore", "w") do |file|
265
+ file.puts Makit::Content::GITIGNORE
266
+ end
267
+ 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.34
4
+ version: 0.0.36
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-12-04 00:00:00.000000000 Z
11
+ date: 2024-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clamp
@@ -157,8 +157,6 @@ executables: []
157
157
  extensions: []
158
158
  extra_rdoc_files: []
159
159
  files:
160
- - lib/generated/makit/v1/makit.v1_pb.rb
161
- - lib/generated/makit/v1/web/link_pb.rb
162
160
  - lib/makit.rb
163
161
  - lib/makit/apache.rb
164
162
  - lib/makit/cli/clean.rb
@@ -187,6 +185,7 @@ files:
187
185
  - lib/makit/git.rb
188
186
  - lib/makit/gitlab_runner.rb
189
187
  - lib/makit/humanize.rb
188
+ - lib/makit/indexer.rb
190
189
  - lib/makit/logging.rb
191
190
  - lib/makit/markdown.rb
192
191
  - lib/makit/mp/basic_object_mp.rb
@@ -228,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
228
227
  - !ruby/object:Gem::Version
229
228
  version: '0'
230
229
  requirements: []
231
- rubygems_version: 3.5.16
230
+ rubygems_version: 3.5.23
232
231
  signing_key:
233
232
  specification_version: 4
234
233
  summary: CI/CD tools for Ruby developers.
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
- # Generated by the protocol buffer compiler. DO NOT EDIT!
3
- # source: 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\x17makit/v1/makit.v1.proto\x12\x08makit.v1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/duration.proto\"\x92\x02\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\x12\n\nreferences\x18\x05 \x03(\t\x12\n\n\x02os\x18\x06 \x01(\t\x12\x10\n\x08\x63ommands\x18\x07 \x03(\t\x12-\n\nbuild_args\x18\x08 \x03(\x0b\x32\x19.makit.v1.DotNetBuildArgs\x12\x31\n\x0cpublish_args\x18\t \x03(\x0b\x32\x1b.makit.v1.DotNetPublishArgs\x12+\n\ttest_args\x18\n \x03(\x0b\x32\x18.makit.v1.DotNetTestArgs\"8\n\x0f\x44otNetBuildArgs\x12\x15\n\rconfiguration\x18\x01 \x01(\t\x12\x0e\n\x06output\x18\x02 \x01(\t\":\n\x11\x44otNetPublishArgs\x12\x15\n\rconfiguration\x18\x01 \x01(\t\x12\x0e\n\x06output\x18\x02 \x01(\t\"7\n\x0e\x44otNetTestArgs\x12\x15\n\rconfiguration\x18\x01 \x01(\t\x12\x0e\n\x06output\x18\x02 \x01(\t\"\xa8\x01\n\x07Project\x12\x16\n\x0egit_remote_url\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x11\n\tartifacts\x18\x03 \x03(\t\x12\x32\n\x10\x63ommand_requests\x18\x04 \x03(\x0b\x32\x18.makit.v1.CommandRequest\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\rManifestEntry\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x31\n\rlast_modified\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0c\n\x04size\x18\x03 \x01(\x03**\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
- DotNetBuildArgs = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.DotNetBuildArgs").msgclass
20
- DotNetPublishArgs = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.DotNetPublishArgs").msgclass
21
- DotNetTestArgs = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.DotNetTestArgs").msgclass
22
- Project = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.Project").msgclass
23
- CommandRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.CommandRequest").msgclass
24
- Command = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.Command").msgclass
25
- Configuration = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.Configuration").msgclass
26
- GitRepository = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.GitRepository").msgclass
27
- GitLogEntry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.GitLogEntry").msgclass
28
- MakeResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.MakeResult").msgclass
29
- DotNetNewArgs = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.DotNetNewArgs").msgclass
30
- ManifestEntry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.ManifestEntry").msgclass
31
- Language = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.Language").enummodule
32
- PackageType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.PackageType").enummodule
33
- end
34
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
- # Generated by the protocol buffer compiler. DO NOT EDIT!
3
- # source: makit/v1/web/link.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\x17makit/v1/web/link.proto\x12\x08makit.v1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/duration.proto\"6\n\x04Link\x12\x0b\n\x03url\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\tb\x06proto3"
12
-
13
- pool = Google::Protobuf::DescriptorPool.generated_pool
14
- pool.add_serialized_file(descriptor_data)
15
-
16
- module Makit
17
- module V1
18
- Link = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("makit.v1.Link").msgclass
19
- end
20
- end