makit 0.0.0 → 0.0.2

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.
Files changed (81) 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 +274 -237
  14. data/lib/makit/commands.rb +21 -21
  15. data/lib/makit/content/default_gitignore.rb +5 -5
  16. data/lib/makit/content/default_rakefile.rb +11 -11
  17. data/lib/makit/content/gem_rakefile.rb +14 -14
  18. data/lib/makit/data.rb +50 -50
  19. data/lib/makit/directories.rb +140 -140
  20. data/lib/makit/directory.rb +151 -120
  21. data/lib/makit/dotnet.rb +83 -16
  22. data/lib/makit/environment.rb +123 -123
  23. data/lib/makit/files.rb +47 -47
  24. data/lib/makit/git.rb +66 -66
  25. data/lib/makit/gitlab_runner.rb +60 -60
  26. data/lib/makit/humanize.rb +89 -89
  27. data/lib/makit/logging.rb +96 -96
  28. data/lib/makit/markdown.rb +75 -75
  29. data/lib/makit/mp/basic_object_mp.rb +16 -16
  30. data/lib/makit/mp/command_request.mp.rb +13 -0
  31. data/lib/makit/mp/project_mp.rb +156 -160
  32. data/lib/makit/mp/string_mp.rb +101 -101
  33. data/lib/makit/nuget.rb +57 -57
  34. data/lib/makit/protoc.rb +61 -61
  35. data/lib/makit/serializer.rb +115 -70
  36. data/lib/makit/storage.rb +131 -131
  37. data/lib/makit/symbols.rb +149 -149
  38. data/lib/makit/tasks.rb +67 -63
  39. data/lib/makit/tree.rb +37 -37
  40. data/lib/makit/v1/makit.v1_pb.rb +5 -5
  41. data/lib/makit/v1/makit.v1_services_pb.rb +25 -26
  42. data/lib/makit/version.rb +12 -12
  43. data/lib/makit/wix.rb +95 -92
  44. data/lib/makit/zip.rb +17 -17
  45. data/lib/makit.rb +243 -243
  46. metadata +8 -43
  47. data/.makit.project.json +0 -4
  48. data/.makit.project.yml +0 -2
  49. data/.rubocop.yml +0 -22
  50. data/.ruby-version +0 -1
  51. data/CHANGELOG.md +0 -8
  52. data/CODE_OF_CONDUCT.md +0 -84
  53. data/LICENSE +0 -21
  54. data/README.md +0 -119
  55. data/Rakefile +0 -190
  56. data/docs/Commands.md +0 -50
  57. data/docs_/Commands.md +0 -166
  58. data/docs_/Minitest.Timeouts.md +0 -332
  59. data/examples/protoc/Rakefile +0 -31
  60. data/examples/rake_default/Rakefile +0 -5
  61. data/examples/rubygem-foo/.gitkeep +0 -0
  62. data/examples/rubygem-foo/Rakefile +0 -3
  63. data/examples/run_mp/Rakefile +0 -8
  64. data/exe/makit +0 -5
  65. data/lib/makit/content/default_gitignore.txt +0 -222
  66. data/lib/makit/content/ruby_gitlab-ci.yml +0 -15
  67. data/lib/makit/v1/makit.v1.proto +0 -103
  68. data/makit.generated.sln +0 -30
  69. data/makit.sln +0 -69
  70. data/pages/.gitignore +0 -5
  71. data/pages/404.html +0 -25
  72. data/pages/Gemfile +0 -33
  73. data/pages/Gemfile.lock +0 -88
  74. data/pages/_config.yml +0 -55
  75. data/pages/_layouts/default.html +0 -1
  76. data/pages/_posts/2024-10-05-welcome-to-jekyll.markdown +0 -29
  77. data/pages/about.markdown +0 -18
  78. data/pages/index.markdown +0 -6
  79. data/sig/makit.rbs +0 -4
  80. data/src/ClassLib/Class1.cs +0 -6
  81. data/src/ClassLib/ClassLib.csproj +0 -13
@@ -1,237 +1,274 @@
1
- require "English"
2
- require "open3"
3
- require "socket"
4
- require "etc"
5
- require "logger"
6
-
7
- # This module provides classes for the Makit gem.
8
- module Makit
9
- # This class provide methods running commands.
10
- #
11
- class CommandRunner
12
- attr_accessor :show_output_on_success, :log_to_artifacts
13
-
14
- def initialize
15
- @show_output_on_success = false
16
- @log_to_artifacts = false
17
- end
18
-
19
- def run(command_request)
20
- raise "Invalid command_request" unless command_request.is_a? Makit::V1::CommandRequest
21
- command = execute(command_request)
22
- show_output = true
23
- exit_on_error = true
24
-
25
- log_to_artifacts(command) if @log_to_artifacts
26
- if command.exit_code != 0
27
- puts Makit::CommandRunner.get_command_summary(command) + " (exit code #{command.exit_code})".colorize(:default)
28
- puts " directory: #{command.directory}\n"
29
- puts " duration: #{command.duration.seconds} seconds\n"
30
- puts Makit::Humanize::indent_string(command.output, 2) if command.output.length > 0
31
- puts Makit::Humanize::indent_string(command.error, 2) if command.error.length > 0
32
- exit 1 if command_request.exit_on_error
33
- else
34
- puts Makit::CommandRunner.get_command_summary(command) + " (#{command.duration.seconds} seconds)".colorize(:cyan)
35
- puts Makit::Humanize::indent_string(command.output, 2).colorize(:default) if show_output_on_success
36
- end
37
-
38
- command
39
- end
40
-
41
- def log_to_artifacts(command)
42
- dir = File.join(Makit::Directories::PROJECT_ARTIFACTS, "commands")
43
- FileUtils.mkdir_p(dir) unless Dir.exist?(dir)
44
- filename_friendly_timestamp = Time.now.strftime("%Y.%m.%d_%H%M%S")
45
- log_filename = File.join(dir, "#{filename_friendly_timestamp}.json")
46
- # serialize to protobuf json
47
- json = command.to_json
48
- pretty_json = JSON.pretty_generate(JSON.parse(json))
49
- File.write(log_filename, pretty_json)
50
- end
51
-
52
- # Run a command and return a Makit::V1::Command.
53
- def try(args)
54
- request = parse_command_request(args)
55
- request.exit_on_error = false
56
- run(request)
57
- #run2(args, false)
58
- end
59
-
60
- # Show the output of a command and return a Makit::V1::Command.
61
- def show(args)
62
- request = parse_args(args)
63
- command = execute(request)
64
-
65
- show_output = true
66
- exit_on_error = true
67
- Makit::LOGGER.info(Makit::CommandRunner.get_command_summary(command))
68
- show_output = true if command.exit_code != 0
69
- Makit::LOGGER.info(indent_string("\n#{command.output}\n#{command.error}\n".strip, 2)) if show_output
70
- exit(command.exit_code) if exit_on_error && command.exit_code != 0 # unless process_status.success?
71
- command
72
- end
73
-
74
- # Parse and return a Makit::V1::CommandRequest.
75
- def parse_command_request(source)
76
- return Makit::V1::CommandRequest.new(source) if source.is_a? Hash
77
- return source if source.is_a? Makit::V1::CommandRequest
78
- if source.is_a? String
79
- return parse_args(source)
80
- end
81
-
82
- raise "Invalid source" unless source.is_a? Makit::V1::CommandRequest
83
- end
84
-
85
- def parse_command_request_from_hash(hash)
86
- raise "Invalid hash" unless hash.is_a? Hash
87
- Makit::V1::CommandRequest.new(hash)
88
- end
89
-
90
- def parse_command_request_from_string(source)
91
- raise "Invalid source" unless source.is_a? String
92
- words = source.split(" ")
93
- hash = {
94
- name: words.shift,
95
- arguments: words,
96
- exit_on_error: true,
97
- }
98
- end
99
-
100
- # Parse the command line arguments into a Makit::V1::CommandRequest.
101
- def parse_args(args)
102
- #raise "No command specified" if args.empty?
103
- if args.is_a? Makit::V1::CommandRequest
104
- args
105
- else
106
- if args.is_a? String
107
- args = args.split(" ")
108
- if (args.length == 1)
109
- hash = {
110
- name: args[0],
111
- arguments: [],
112
- exit_on_error: true,
113
- }
114
- Makit::V1::CommandRequest.new(hash)
115
- else
116
- hash = {
117
- name: args.shift,
118
- arguments: args,
119
- exit_on_error: true,
120
- }
121
-
122
- Makit::V1::CommandRequest.new(hash)
123
- end
124
- else
125
- Makit::V1::CommandRequest.new(args)
126
- end
127
- end
128
- end
129
-
130
- def get_path_name(name)
131
- # replace all characters that a not valid in a filename with an underscore
132
- name.gsub(/[^0-9a-z]/i, "_")
133
- end
134
-
135
- # Given a Makit::V1::CommandRequest, execute the command and return a Makit::V1::Command.
136
- def execute(args)
137
- command_request = parse_args(args)
138
- command_request.directory = Dir.pwd if command_request.directory.nil?
139
- command_request.directory = Dir.pwd if command_request.directory.length == 0
140
- result = Makit::V1::Command.new(name: command_request.name)
141
- command_request.arguments.each do |arg|
142
- result.arguments.push(arg)
143
- end
144
- command = "#{command_request.name} #{command_request.arguments.join(" ")}"
145
- result.directory = command_request.directory
146
- start = Time.now
147
- filename_friendly_timestamp = Time.now.strftime("%Y.%m.%d_%H%M%S")
148
- log_filename = File.join(Makit::Directories::LOG, "#{filename_friendly_timestamp}.log")
149
-
150
- # assign a directory variable to the current working directory, if not specified,
151
- # otherwise assign the specified directory
152
- command_request.directory = Dir.pwd if command_request.directory.nil?
153
- command_request.directory = Dir.pwd if command_request.directory.length == 0
154
- raise "Invalid directory" unless Dir.exist?(command_request.directory)
155
-
156
- result.started_at = Google::Protobuf::Timestamp.new(seconds: start.to_i, nanos: start.nsec.to_i)
157
- ############# execute the command
158
- (output, error, exit_code) = execute_command(command, command_request.directory, command_request.timeout)
159
- result.output = output.force_encoding("ASCII-8BIT")
160
- result.error = error.force_encoding("ASCII-8BIT")
161
- result.exit_code = exit_code.nil? ? 0 : exit_code
162
-
163
-
164
- elapsed_time = Time.now - start
165
- seconds = elapsed_time.to_i
166
- nanos = ((elapsed_time - seconds) * 1_000_000_000).to_i
167
-
168
- result.duration = Google::Protobuf::Duration.new(seconds: seconds, nanos: nanos)
169
-
170
- result
171
- end
172
-
173
- # pure function to execute a command
174
- # returns (stdout, stderr, exit_code) or raise an exception
175
- def execute_command(command, directory, timeout)
176
- original_directory = Dir.pwd
177
- begin
178
- output = nil
179
- error = nil
180
- process_status = nil
181
- Dir.chdir(directory) do
182
- output, error, process_status = Open3.capture3(command)
183
- end
184
- return [output, error, process_status.exitstatus]
185
- rescue => e
186
- # restore the original working directory
187
- Dir.chdir(original_directory)
188
- message_parts = []
189
- message_parts << "failed to execute #{command}"
190
- message_parts << "directory: #{directory}"
191
- message_parts << "timeout: #{timeout}" unless timeout.nil?
192
- message_parts << "error: #{e.message}"
193
- message = message_parts.join("\n") + "\n"
194
- return ["", message, 1]
195
- #raise Makit::Error, message
196
- end
197
- end
198
-
199
- def execute_command_request(command_request)
200
- # if the command_request is not a Makit::V1::CommandRequest, raise an error
201
- raise "Invalid command_request" unless command_request.is_a? Makit::V1::CommandRequest
202
-
203
- args = Array.new
204
- command_request.arguments.each do |arg|
205
- args.push(arg)
206
- end
207
- result = Makit::V1::Command.new({
208
- name: command_request.name,
209
- arguments: args,
210
- started_at: Google::Protobuf::Timestamp.new({ seconds: Time.now.to_i, nanos: Time.now.nsec }),
211
- })
212
-
213
- begin
214
- rescue => e
215
- end
216
- end
217
-
218
- def indent_string(input_string, indent_spaces)
219
- indentation = " " * indent_spaces
220
- input_string.lines.map { |line| indentation + line }.join
221
- end
222
-
223
- def self.get_command_summary(command)
224
- symbol = Makit::Symbols.warning
225
- symbol = Makit::Symbols.checkmark if !command.exit_code.nil? && command.exit_code.zero?
226
- symbol = Makit::Symbols.error if command.exit_code != 0
227
- summary = "#{symbol} #{command.name.colorize(:yellow)} #{command.arguments.join(" ")}"
228
-
229
- if summary.length > 80
230
- summary = summary.to_lines(80,command.name.length+3)
231
- end
232
-
233
- summary
234
- end
235
-
236
- end # class CommandRunner
237
- end # module Makit
1
+ require "English"
2
+ require "open3"
3
+ require "socket"
4
+ require "etc"
5
+ require "logger"
6
+
7
+ # This module provides classes for the Makit gem.
8
+ module Makit
9
+ # This class provide methods running commands.
10
+ #
11
+ class CommandRunner
12
+ attr_accessor :show_output_on_success, :log_to_artifacts, :commands
13
+
14
+ def initialize
15
+ @show_output_on_success = false
16
+ @log_to_artifacts = false
17
+ @commands = []
18
+ end
19
+
20
+ # if there is a matching cached command result, that then the specified timestamp,
21
+ # then return the cached result
22
+ # otherwise run the command and save the result to a cache file
23
+ # then return the result
24
+ def cache_run(command_request, timestamp)
25
+ # combine the command name and arguments into a single string
26
+ # and use it to create a cache filename, making sure it is a valid filename,
27
+ # by replacing all characters that are not valid in a filename with an underscore
28
+ # also replacing any path delimiters with an underscore
29
+ cache_filename = Makit::Directories::PROJECT_ARTIFACTS +
30
+ "/commands/#{command_request.to_hash}.pb"
31
+ puts "cache_filename: #{cache_filename}"
32
+
33
+
34
+ #cache_filename = Makit::Directories::PROJECT_ARTIFACTS + "/commands/#{command_request.name}.#{command_request.arguments.join("_")}.#{timestamp.seconds}.pb"
35
+ if File.exist?(cache_filename)
36
+ puts "cache file date: #{File.mtime(cache_filename)}"
37
+ if(File.mtime(cache_filename) > timestamp)
38
+ puts "cache_filename exists and is newer than #{timestamp}"
39
+ return Makit::Serializer.open(cache_filename, Makit::V1::Command)
40
+ else
41
+ puts "cache_filename exists, but is older than #{timestamp}"
42
+ end
43
+ end
44
+
45
+
46
+
47
+ command = run(command_request)
48
+ # make sure the cache directory exists
49
+ FileUtils.mkdir_p(File.dirname(cache_filename))
50
+ puts "saving command to cache_filename"
51
+ Makit::Serializer.save_as(cache_filename, command)
52
+ command
53
+
54
+ end
55
+
56
+ # Run a command and return a Makit::V1::Command.
57
+ def run(command_request)
58
+ raise "Invalid command_request" unless command_request.is_a? Makit::V1::CommandRequest
59
+ command = execute(command_request)
60
+ show_output = true
61
+ exit_on_error = true
62
+
63
+ log_to_artifacts(command) if @log_to_artifacts
64
+ if command.exit_code != 0
65
+ puts Makit::CommandRunner.get_command_summary(command) + " (exit code #{command.exit_code})".colorize(:default)
66
+ puts " directory: #{command.directory}\n"
67
+ puts " duration: #{command.duration.seconds} seconds\n"
68
+ puts Makit::Humanize::indent_string(command.output, 2) if command.output.length > 0
69
+ puts Makit::Humanize::indent_string(command.error, 2) if command.error.length > 0
70
+ exit 1 if command_request.exit_on_error
71
+ else
72
+ puts Makit::CommandRunner.get_command_summary(command) + " (#{command.duration.seconds} seconds)".colorize(:cyan)
73
+ puts Makit::Humanize::indent_string(command.output, 2).colorize(:default) if show_output_on_success
74
+ end
75
+
76
+ commands.push(command)
77
+ command
78
+ end
79
+
80
+ def log_to_artifacts(command)
81
+ dir = File.join(Makit::Directories::PROJECT_ARTIFACTS, "commands")
82
+ FileUtils.mkdir_p(dir) unless Dir.exist?(dir)
83
+ filename_friendly_timestamp = Time.now.strftime("%Y.%m.%d_%H%M%S")
84
+ log_filename = File.join(dir, "#{filename_friendly_timestamp}.json")
85
+ # serialize to protobuf json
86
+ json = command.to_json
87
+ pretty_json = JSON.pretty_generate(JSON.parse(json))
88
+ File.write(log_filename, pretty_json)
89
+ end
90
+
91
+ # Run a command and return a Makit::V1::Command.
92
+ def try(args)
93
+ request = parse_command_request(args)
94
+ request.exit_on_error = false
95
+ run(request)
96
+ #run2(args, false)
97
+ end
98
+
99
+ # Show the output of a command and return a Makit::V1::Command.
100
+ def show(args)
101
+ request = parse_args(args)
102
+ command = execute(request)
103
+
104
+ show_output = true
105
+ exit_on_error = true
106
+ Makit::LOGGER.info(Makit::CommandRunner.get_command_summary(command))
107
+ show_output = true if command.exit_code != 0
108
+ Makit::LOGGER.info(indent_string("\n#{command.output}\n#{command.error}\n".strip, 2)) if show_output
109
+ exit(command.exit_code) if exit_on_error && command.exit_code != 0 # unless process_status.success?
110
+ command
111
+ end
112
+
113
+ # Parse and return a Makit::V1::CommandRequest.
114
+ def parse_command_request(source)
115
+ return Makit::V1::CommandRequest.new(source) if source.is_a? Hash
116
+ return source if source.is_a? Makit::V1::CommandRequest
117
+ if source.is_a? String
118
+ return parse_args(source)
119
+ end
120
+
121
+ raise "Invalid source" unless source.is_a? Makit::V1::CommandRequest
122
+ end
123
+
124
+ def parse_command_request_from_hash(hash)
125
+ raise "Invalid hash" unless hash.is_a? Hash
126
+ Makit::V1::CommandRequest.new(hash)
127
+ end
128
+
129
+ def parse_command_request_from_string(source)
130
+ raise "Invalid source" unless source.is_a? String
131
+ words = source.split(" ")
132
+ hash = {
133
+ name: words.shift,
134
+ arguments: words,
135
+ exit_on_error: true,
136
+ }
137
+ end
138
+
139
+ # Parse the command line arguments into a Makit::V1::CommandRequest.
140
+ def parse_args(args)
141
+ #raise "No command specified" if args.empty?
142
+ if args.is_a? Makit::V1::CommandRequest
143
+ args
144
+ else
145
+ if args.is_a? String
146
+ args = args.split(" ")
147
+ if (args.length == 1)
148
+ hash = {
149
+ name: args[0],
150
+ arguments: [],
151
+ exit_on_error: true,
152
+ }
153
+ Makit::V1::CommandRequest.new(hash)
154
+ else
155
+ hash = {
156
+ name: args.shift,
157
+ arguments: args,
158
+ exit_on_error: true,
159
+ }
160
+
161
+ Makit::V1::CommandRequest.new(hash)
162
+ end
163
+ else
164
+ Makit::V1::CommandRequest.new(args)
165
+ end
166
+ end
167
+ end
168
+
169
+ def get_path_name(name)
170
+ # replace all characters that a not valid in a filename with an underscore
171
+ name.gsub(/[^0-9a-z]/i, "_")
172
+ end
173
+
174
+ # Given a Makit::V1::CommandRequest, execute the command and return a Makit::V1::Command.
175
+ def execute(args)
176
+ command_request = parse_args(args)
177
+ command_request.directory = Dir.pwd if command_request.directory.nil?
178
+ command_request.directory = Dir.pwd if command_request.directory.length == 0
179
+ result = Makit::V1::Command.new(name: command_request.name)
180
+ command_request.arguments.each do |arg|
181
+ result.arguments.push(arg)
182
+ end
183
+ command = "#{command_request.name} #{command_request.arguments.join(" ")}"
184
+ result.directory = command_request.directory
185
+ start = Time.now
186
+ filename_friendly_timestamp = Time.now.strftime("%Y.%m.%d_%H%M%S")
187
+ log_filename = File.join(Makit::Directories::LOG, "#{filename_friendly_timestamp}.log")
188
+
189
+ # assign a directory variable to the current working directory, if not specified,
190
+ # otherwise assign the specified directory
191
+ command_request.directory = Dir.pwd if command_request.directory.nil?
192
+ command_request.directory = Dir.pwd if command_request.directory.length == 0
193
+ raise "Invalid directory" unless Dir.exist?(command_request.directory)
194
+
195
+ result.started_at = Google::Protobuf::Timestamp.new(seconds: start.to_i, nanos: start.nsec.to_i)
196
+ ############# execute the command
197
+ (output, error, exit_code) = execute_command(command, command_request.directory, command_request.timeout)
198
+ result.output = output.force_encoding("ASCII-8BIT")
199
+ result.error = error.force_encoding("ASCII-8BIT")
200
+ result.exit_code = exit_code.nil? ? 0 : exit_code
201
+
202
+ elapsed_time = Time.now - start
203
+ seconds = elapsed_time.to_i
204
+ nanos = ((elapsed_time - seconds) * 1_000_000_000).to_i
205
+
206
+ result.duration = Google::Protobuf::Duration.new(seconds: seconds, nanos: nanos)
207
+
208
+ result
209
+ end
210
+
211
+ # pure function to execute a command
212
+ # returns (stdout, stderr, exit_code) or raise an exception
213
+ def execute_command(command, directory, timeout)
214
+ original_directory = Dir.pwd
215
+ begin
216
+ output = nil
217
+ error = nil
218
+ process_status = nil
219
+ Dir.chdir(directory) do
220
+ output, error, process_status = Open3.capture3(command)
221
+ end
222
+ return [output, error, process_status.exitstatus]
223
+ rescue => e
224
+ # restore the original working directory
225
+ Dir.chdir(original_directory)
226
+ message_parts = []
227
+ message_parts << "failed to execute #{command}"
228
+ message_parts << "directory: #{directory}"
229
+ message_parts << "timeout: #{timeout}" unless timeout.nil?
230
+ message_parts << "error: #{e.message}"
231
+ message = message_parts.join("\n") + "\n"
232
+ return ["", message, 1]
233
+ #raise Makit::Error, message
234
+ end
235
+ end
236
+
237
+ def execute_command_request(command_request)
238
+ # if the command_request is not a Makit::V1::CommandRequest, raise an error
239
+ raise "Invalid command_request" unless command_request.is_a? Makit::V1::CommandRequest
240
+
241
+ args = Array.new
242
+ command_request.arguments.each do |arg|
243
+ args.push(arg)
244
+ end
245
+ result = Makit::V1::Command.new({
246
+ name: command_request.name,
247
+ arguments: args,
248
+ started_at: Google::Protobuf::Timestamp.new({ seconds: Time.now.to_i, nanos: Time.now.nsec }),
249
+ })
250
+
251
+ begin
252
+ rescue => e
253
+ end
254
+ end
255
+
256
+ def indent_string(input_string, indent_spaces)
257
+ indentation = " " * indent_spaces
258
+ input_string.lines.map { |line| indentation + line }.join
259
+ end
260
+
261
+ def self.get_command_summary(command)
262
+ symbol = Makit::Symbols.warning
263
+ symbol = Makit::Symbols.checkmark if !command.exit_code.nil? && command.exit_code.zero?
264
+ symbol = Makit::Symbols.error if command.exit_code != 0
265
+ summary = "#{symbol} #{command.name.colorize(:yellow)} #{command.arguments.join(" ")}"
266
+
267
+ if summary.length > 80
268
+ summary = summary.to_lines(80, command.name.length + 3)
269
+ end
270
+
271
+ summary
272
+ end
273
+ end # class CommandRunner
274
+ end # module Makit
@@ -1,21 +1,21 @@
1
- # frozen_string_literal: true
2
-
3
- require "English"
4
- require "open3"
5
- require "socket"
6
- require "etc"
7
- require "logger"
8
-
9
- # This module provides classes for the Makit gem.
10
- module Makit
11
- # This class provide methods running commands.
12
- #
13
- class Commands < Array
14
-
15
- # Generate the commands based on the current directory.
16
- def auto_generate
17
- self << Makit::V1::CommandRequest.new(name: "bundle", arguments: ["install"]) if File.exist?("Gemfile")
18
- self << Makit::V1::CommandRequest.new(name: "bundle", arguments: ["exec", "rake"]) if File.exist?("Rakefile")
19
- end
20
- end
21
- end
1
+ # frozen_string_literal: true
2
+
3
+ require "English"
4
+ require "open3"
5
+ require "socket"
6
+ require "etc"
7
+ require "logger"
8
+
9
+ # This module provides classes for the Makit gem.
10
+ module Makit
11
+ # This class provide methods running commands.
12
+ #
13
+ class Commands < Array
14
+
15
+ # Generate the commands based on the current directory.
16
+ def auto_generate
17
+ self << Makit::V1::CommandRequest.new(name: "bundle", arguments: ["install"]) if File.exist?("Gemfile")
18
+ self << Makit::V1::CommandRequest.new(name: "bundle", arguments: ["exec", "rake"]) if File.exist?("Rakefile")
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
- module Makit
2
- module Content
3
- GITIGNORE = File.read(File.join(__dir__, "default_gitignore.txt"))
4
- end # module Content
5
- end # module Makit
1
+ module Makit
2
+ module Content
3
+ GITIGNORE = File.read(File.join(__dir__, "default_gitignore.txt"))
4
+ end # module Content
5
+ end # module Makit
@@ -1,11 +1,11 @@
1
- module Makit
2
- module Content
3
- RAKEFILE = <<~HEREDOC
4
- require "makit"
5
-
6
- task :default do
7
- end
8
-
9
- HEREDOC
10
- end # module Content
11
- end # module Makit
1
+ module Makit
2
+ module Content
3
+ RAKEFILE = <<~HEREDOC
4
+ require "makit"
5
+
6
+ task :default do
7
+ end
8
+
9
+ HEREDOC
10
+ end # module Content
11
+ end # module Makit
@@ -1,14 +1,14 @@
1
- module Makit
2
- module Content
3
- GEM_RAKEFILE = <<~HEREDOC
4
- require "bundler/gem_tasks" # for build, install and release tasks
5
- require "minitest/test_task"
6
- Minitest::TestTask.create
7
- require "makit"
8
-
9
- task :default => [:build, :install] do
10
- end
11
-
12
- HEREDOC
13
- end # module Content
14
- end # module Makit
1
+ module Makit
2
+ module Content
3
+ GEM_RAKEFILE = <<~HEREDOC
4
+ require "bundler/gem_tasks" # for build, install and release tasks
5
+ require "minitest/test_task"
6
+ Minitest::TestTask.create
7
+ require "makit"
8
+
9
+ task :default => [:build, :install] do
10
+ end
11
+
12
+ HEREDOC
13
+ end # module Content
14
+ end # module Makit