raykit 0.0.503 → 0.0.505
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -21
- data/README.md +25 -25
- data/bin/raykit +6 -6
- data/lib/raykit/auto_setup.rb +69 -69
- data/lib/raykit/command.rb +373 -373
- data/lib/raykit/conan/buildinfo.rb +69 -69
- data/lib/raykit/conanpackage.rb +49 -49
- data/lib/raykit/configuration.rb +53 -53
- data/lib/raykit/console.rb +318 -314
- data/lib/raykit/default_content.rb +227 -227
- data/lib/raykit/dir.rb +49 -49
- data/lib/raykit/dotnet.rb +174 -174
- data/lib/raykit/environment.rb +114 -114
- data/lib/raykit/filesystem.rb +34 -34
- data/lib/raykit/git/commit.rb +16 -16
- data/lib/raykit/git/directory.rb +216 -216
- data/lib/raykit/git/files.rb +46 -46
- data/lib/raykit/git/repositories.rb +89 -89
- data/lib/raykit/git/repository.rb +376 -376
- data/lib/raykit/installer.rb +17 -17
- data/lib/raykit/log.rb +80 -80
- data/lib/raykit/logevent.rb +49 -49
- data/lib/raykit/logger.rb +98 -0
- data/lib/raykit/logging.rb +57 -57
- data/lib/raykit/markdown.rb +21 -21
- data/lib/raykit/msbuild.rb +54 -54
- data/lib/raykit/nugetpackage.rb +54 -54
- data/lib/raykit/nunit.rb +13 -13
- data/lib/raykit/project.rb +343 -343
- data/lib/raykit/rake.rb +39 -39
- data/lib/raykit/runner.rb +42 -42
- data/lib/raykit/secrets.rb +38 -38
- data/lib/raykit/sourceImport.rb +76 -76
- data/lib/raykit/sourceImports.rb +43 -43
- data/lib/raykit/string.rb +18 -18
- data/lib/raykit/symbols.rb +115 -16
- data/lib/raykit/tasks.rb +99 -99
- data/lib/raykit/text.rb +32 -32
- data/lib/raykit/timer.rb +31 -31
- data/lib/raykit/version.rb +89 -103
- data/lib/raykit/vstest.rb +24 -24
- data/lib/raykit/wt.rb +28 -28
- data/lib/raykit/zip.rb +73 -73
- data/lib/raykit.rb +126 -125
- metadata +4 -3
data/lib/raykit/console.rb
CHANGED
@@ -1,314 +1,318 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "optparse"
|
4
|
-
require "slop"
|
5
|
-
require_relative("./logging")
|
6
|
-
|
7
|
-
module Raykit
|
8
|
-
# The implementation for the raykit console application
|
9
|
-
class Console
|
10
|
-
attr_accessor :opts
|
11
|
-
|
12
|
-
def self.get_opts
|
13
|
-
Slop.parse do |o|
|
14
|
-
o.string "-t", "--task", "rake task", default: "default"
|
15
|
-
o.bool "-v", "--verbose", "print detailed output", default: false
|
16
|
-
o.bool "-q", "--quiet", "minimal output", default: false
|
17
|
-
o.bool "-s", "--stop", "stop on error", default: true
|
18
|
-
end
|
19
|
-
end # def self.get_opts
|
20
|
-
|
21
|
-
def initialize(opts = nil)
|
22
|
-
if opts.nil?
|
23
|
-
@opts = Console.get_opts
|
24
|
-
else
|
25
|
-
@opts = opts
|
26
|
-
end
|
27
|
-
#@opts = Slop.parse do |o|
|
28
|
-
# o.string "-t", "--task", "rake task", default: "default"
|
29
|
-
# o.bool "-v", "--verbose", "print detailed output", default: false
|
30
|
-
# o.bool "-q", "--quiet", "minimal output", default: false
|
31
|
-
# o.bool "-s", "--stop", "stop on error", default: true
|
32
|
-
#end
|
33
|
-
|
34
|
-
#if opts.verbose?
|
35
|
-
# puts "options: #{Rainbow(@opts.to_hash).yellow.bright}"
|
36
|
-
# puts "arguments:#{Rainbow(@opts.arguments).yellow.bright}"
|
37
|
-
#end
|
38
|
-
end
|
39
|
-
|
40
|
-
def run
|
41
|
-
verb = "usage"
|
42
|
-
verb = @opts.arguments[0] if @opts.arguments.length.positive?
|
43
|
-
case verb
|
44
|
-
when "usage"
|
45
|
-
usage
|
46
|
-
when "add"
|
47
|
-
add
|
48
|
-
when "remove"
|
49
|
-
remove
|
50
|
-
when "list"
|
51
|
-
list
|
52
|
-
when "show"
|
53
|
-
show
|
54
|
-
when "work"
|
55
|
-
work
|
56
|
-
when "import"
|
57
|
-
import
|
58
|
-
when "clean"
|
59
|
-
clean
|
60
|
-
when "sync_version"
|
61
|
-
sync_version
|
62
|
-
when "copy"
|
63
|
-
copy
|
64
|
-
when "pull"
|
65
|
-
pull
|
66
|
-
else
|
67
|
-
puts "unrecognized command #{verb}"
|
68
|
-
1
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def verb_descriptions
|
73
|
-
{ "add" => "add a git url",
|
74
|
-
"remove" => "remove one or more git urls",
|
75
|
-
"list" => "list summaries of repositories",
|
76
|
-
"show" => "show git urls matching a specific pattern",
|
77
|
-
"work" => "clone and rake a git repository",
|
78
|
-
"import" => "import git urls matching a specific pattern",
|
79
|
-
"clean" => "clean one or more working directories",
|
80
|
-
"pull" => "preform git pull on one or more working directories",
|
81
|
-
"sync_version" => "synchronize the version number between two files",
|
82
|
-
"copy" => "copy a file" }
|
83
|
-
end
|
84
|
-
|
85
|
-
def verb_usage
|
86
|
-
{ "add" => "add GIT_URL",
|
87
|
-
"remove" => "remove URL_PATTERN",
|
88
|
-
"show" => "show URL_PATTERN",
|
89
|
-
"work" => "work URL_PATTERN [--task RAKE_TASK]",
|
90
|
-
"import" => "import URL_PATTERN",
|
91
|
-
"clean" => "clean URL_PATTERN",
|
92
|
-
"pull" => "pull URL_PATTERN",
|
93
|
-
"sync_version" => "sync_version SOURCE_FILENAME DESTINATION_FILENAME",
|
94
|
-
"copy" => "copy SOURCE DESTINATION" }
|
95
|
-
end
|
96
|
-
|
97
|
-
def usage
|
98
|
-
puts "Usage: raykit VERB [GIT_URL|PATTERN] [OPTIONS]"
|
99
|
-
verb_descriptions.each do |k, v|
|
100
|
-
puts "#{k.ljust(15, " ")} - #{v}"
|
101
|
-
end
|
102
|
-
# puts @opts
|
103
|
-
# puts "verbs: " + verbs.to_s
|
104
|
-
0
|
105
|
-
end
|
106
|
-
|
107
|
-
def add
|
108
|
-
if @opts.arguments.length < 2
|
109
|
-
puts "add requires a url"
|
110
|
-
return 1
|
111
|
-
end
|
112
|
-
url = @opts.arguments[1]
|
113
|
-
if REPOSITORIES.include?(url)
|
114
|
-
puts "url #{url} already exists."
|
115
|
-
else
|
116
|
-
REPOSITORIES << url
|
117
|
-
REPOSITORIES.save(REPOSITORIES.filename)
|
118
|
-
puts "url #{url} added."
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
def remove
|
123
|
-
if @opts.arguments.length < 2
|
124
|
-
puts "remove requires a url or pattern"
|
125
|
-
return 1
|
126
|
-
end
|
127
|
-
pattern = ""
|
128
|
-
pattern = @opts.arguments[1] if @opts.arguments.length > 1
|
129
|
-
remove_urls = REPOSITORIES.matches(pattern)
|
130
|
-
if remove_urls.length.zero?
|
131
|
-
puts "no matching urls found."
|
132
|
-
else
|
133
|
-
remove_urls.each do |url|
|
134
|
-
REPOSITORIES.delete(url)
|
135
|
-
puts "url #{url} removed."
|
136
|
-
end
|
137
|
-
REPOSITORIES.save(REPOSITORIES.filename)
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
def list
|
142
|
-
pattern = ""
|
143
|
-
pattern = @opts.arguments[1] if @opts.arguments.length > 1
|
144
|
-
REPOSITORIES.matches(pattern).each do |url|
|
145
|
-
repo = Raykit::Git::Repository.new(url)
|
146
|
-
puts repo.to_s
|
147
|
-
#puts url
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
def show
|
152
|
-
pattern = ""
|
153
|
-
pattern = @opts.arguments[1] if @opts.arguments.length > 1
|
154
|
-
REPOSITORIES.matches(pattern).each do |url|
|
155
|
-
puts url
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
def work
|
160
|
-
pattern = ""
|
161
|
-
pattern = @opts.arguments[1] if @opts.arguments.length > 1
|
162
|
-
logger = Logger.new(STDOUT)
|
163
|
-
|
164
|
-
logger.
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
logger.
|
169
|
-
|
170
|
-
work_repositories
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
logger.info(
|
177
|
-
#puts
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
puts "
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
puts "
|
305
|
-
|
306
|
-
puts "#{
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "optparse"
|
4
|
+
require "slop"
|
5
|
+
require_relative("./logging")
|
6
|
+
|
7
|
+
module Raykit
|
8
|
+
# The implementation for the raykit console application
|
9
|
+
class Console
|
10
|
+
attr_accessor :opts
|
11
|
+
|
12
|
+
def self.get_opts
|
13
|
+
Slop.parse do |o|
|
14
|
+
o.string "-t", "--task", "rake task", default: "default"
|
15
|
+
o.bool "-v", "--verbose", "print detailed output", default: false
|
16
|
+
o.bool "-q", "--quiet", "minimal output", default: false
|
17
|
+
o.bool "-s", "--stop", "stop on error", default: true
|
18
|
+
end
|
19
|
+
end # def self.get_opts
|
20
|
+
|
21
|
+
def initialize(opts = nil)
|
22
|
+
if opts.nil?
|
23
|
+
@opts = Console.get_opts
|
24
|
+
else
|
25
|
+
@opts = opts
|
26
|
+
end
|
27
|
+
#@opts = Slop.parse do |o|
|
28
|
+
# o.string "-t", "--task", "rake task", default: "default"
|
29
|
+
# o.bool "-v", "--verbose", "print detailed output", default: false
|
30
|
+
# o.bool "-q", "--quiet", "minimal output", default: false
|
31
|
+
# o.bool "-s", "--stop", "stop on error", default: true
|
32
|
+
#end
|
33
|
+
|
34
|
+
#if opts.verbose?
|
35
|
+
# puts "options: #{Rainbow(@opts.to_hash).yellow.bright}"
|
36
|
+
# puts "arguments:#{Rainbow(@opts.arguments).yellow.bright}"
|
37
|
+
#end
|
38
|
+
end
|
39
|
+
|
40
|
+
def run
|
41
|
+
verb = "usage"
|
42
|
+
verb = @opts.arguments[0] if @opts.arguments.length.positive?
|
43
|
+
case verb
|
44
|
+
when "usage"
|
45
|
+
usage
|
46
|
+
when "add"
|
47
|
+
add
|
48
|
+
when "remove"
|
49
|
+
remove
|
50
|
+
when "list"
|
51
|
+
list
|
52
|
+
when "show"
|
53
|
+
show
|
54
|
+
when "work"
|
55
|
+
work
|
56
|
+
when "import"
|
57
|
+
import
|
58
|
+
when "clean"
|
59
|
+
clean
|
60
|
+
when "sync_version"
|
61
|
+
sync_version
|
62
|
+
when "copy"
|
63
|
+
copy
|
64
|
+
when "pull"
|
65
|
+
pull
|
66
|
+
else
|
67
|
+
puts "unrecognized command #{verb}"
|
68
|
+
1
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def verb_descriptions
|
73
|
+
{ "add" => "add a git url",
|
74
|
+
"remove" => "remove one or more git urls",
|
75
|
+
"list" => "list summaries of repositories",
|
76
|
+
"show" => "show git urls matching a specific pattern",
|
77
|
+
"work" => "clone and rake a git repository",
|
78
|
+
"import" => "import git urls matching a specific pattern",
|
79
|
+
"clean" => "clean one or more working directories",
|
80
|
+
"pull" => "preform git pull on one or more working directories",
|
81
|
+
"sync_version" => "synchronize the version number between two files",
|
82
|
+
"copy" => "copy a file" }
|
83
|
+
end
|
84
|
+
|
85
|
+
def verb_usage
|
86
|
+
{ "add" => "add GIT_URL",
|
87
|
+
"remove" => "remove URL_PATTERN",
|
88
|
+
"show" => "show URL_PATTERN",
|
89
|
+
"work" => "work URL_PATTERN [--task RAKE_TASK]",
|
90
|
+
"import" => "import URL_PATTERN",
|
91
|
+
"clean" => "clean URL_PATTERN",
|
92
|
+
"pull" => "pull URL_PATTERN",
|
93
|
+
"sync_version" => "sync_version SOURCE_FILENAME DESTINATION_FILENAME",
|
94
|
+
"copy" => "copy SOURCE DESTINATION" }
|
95
|
+
end
|
96
|
+
|
97
|
+
def usage
|
98
|
+
puts "Usage: raykit VERB [GIT_URL|PATTERN] [OPTIONS]"
|
99
|
+
verb_descriptions.each do |k, v|
|
100
|
+
puts "#{k.ljust(15, " ")} - #{v}"
|
101
|
+
end
|
102
|
+
# puts @opts
|
103
|
+
# puts "verbs: " + verbs.to_s
|
104
|
+
0
|
105
|
+
end
|
106
|
+
|
107
|
+
def add
|
108
|
+
if @opts.arguments.length < 2
|
109
|
+
puts "add requires a url"
|
110
|
+
return 1
|
111
|
+
end
|
112
|
+
url = @opts.arguments[1]
|
113
|
+
if REPOSITORIES.include?(url)
|
114
|
+
puts "url #{url} already exists."
|
115
|
+
else
|
116
|
+
REPOSITORIES << url
|
117
|
+
REPOSITORIES.save(REPOSITORIES.filename)
|
118
|
+
puts "url #{url} added."
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def remove
|
123
|
+
if @opts.arguments.length < 2
|
124
|
+
puts "remove requires a url or pattern"
|
125
|
+
return 1
|
126
|
+
end
|
127
|
+
pattern = ""
|
128
|
+
pattern = @opts.arguments[1] if @opts.arguments.length > 1
|
129
|
+
remove_urls = REPOSITORIES.matches(pattern)
|
130
|
+
if remove_urls.length.zero?
|
131
|
+
puts "no matching urls found."
|
132
|
+
else
|
133
|
+
remove_urls.each do |url|
|
134
|
+
REPOSITORIES.delete(url)
|
135
|
+
puts "url #{url} removed."
|
136
|
+
end
|
137
|
+
REPOSITORIES.save(REPOSITORIES.filename)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def list
|
142
|
+
pattern = ""
|
143
|
+
pattern = @opts.arguments[1] if @opts.arguments.length > 1
|
144
|
+
REPOSITORIES.matches(pattern).each do |url|
|
145
|
+
repo = Raykit::Git::Repository.new(url)
|
146
|
+
puts repo.to_s
|
147
|
+
#puts url
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
def show
|
152
|
+
pattern = ""
|
153
|
+
pattern = @opts.arguments[1] if @opts.arguments.length > 1
|
154
|
+
REPOSITORIES.matches(pattern).each do |url|
|
155
|
+
puts url
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
def work
|
160
|
+
pattern = ""
|
161
|
+
pattern = @opts.arguments[1] if @opts.arguments.length > 1
|
162
|
+
logger = Logger.new(STDOUT)
|
163
|
+
# Set the formatter to output just the message
|
164
|
+
logger.formatter = proc do |_severity, _datetime, _progname, msg|
|
165
|
+
"#{msg}\n"
|
166
|
+
end
|
167
|
+
logger.level = Logger::DEBUG
|
168
|
+
logger.debug("work: pattern: #{pattern}")
|
169
|
+
|
170
|
+
work_repositories = REPOSITORIES.matches(pattern)
|
171
|
+
errors = []
|
172
|
+
logger.info("work: found #{work_repositories.length} matching urls")
|
173
|
+
#puts "work: found #{work_repositories.length} matching urls"
|
174
|
+
work_repositories.each do |url|
|
175
|
+
default_command = "rake default"
|
176
|
+
logger.info("work: #{url} #{default_command}")
|
177
|
+
#puts "work: #{url} #{default_command}"
|
178
|
+
repo = Raykit::Git::Repository.new(url)
|
179
|
+
cmd = repo.work default_command
|
180
|
+
logger.info(cmd.to_s)
|
181
|
+
#puts cmd.to_s
|
182
|
+
#exitstatus = work_url(url)
|
183
|
+
#puts " " if @opts.verbose?
|
184
|
+
#return exitstatus if @opts[:stop] && exitstatus != 0
|
185
|
+
end
|
186
|
+
0
|
187
|
+
end
|
188
|
+
|
189
|
+
#puts "\nwork \"rake default\""
|
190
|
+
#cmd = repo.work "rake default"
|
191
|
+
#puts cmd.to_s
|
192
|
+
|
193
|
+
def work_url(url)
|
194
|
+
return 0 if url == "https://gitlab.com/gems-rb/raykit.git"
|
195
|
+
|
196
|
+
puts Rainbow(url).yellow.bright if @opts.verbose?
|
197
|
+
repo = Raykit::Git::Repository.new(url)
|
198
|
+
work = Raykit::Git::Directory.new(repo.get_dev_dir("work"))
|
199
|
+
unless Dir.exist?(work.directory)
|
200
|
+
clone = Command.new("git clone #{url} #{work.directory} --recursive")
|
201
|
+
puts clone.summary unless @opts.quiet?
|
202
|
+
if clone.exitstatus != 0
|
203
|
+
clone.details
|
204
|
+
return clone.exitstatus
|
205
|
+
end
|
206
|
+
end
|
207
|
+
if Dir.exist?(work.directory)
|
208
|
+
Dir.chdir(work.directory) do
|
209
|
+
if File.exist?("rakefile.rb")
|
210
|
+
rake = Raykit::Command.new("rake #{@opts[:task]}")
|
211
|
+
rake.summary(true) if !@opts.quiet? || rake.exitstatus != 0
|
212
|
+
if rake.exitstatus != 0
|
213
|
+
rake.details
|
214
|
+
rake.summary true
|
215
|
+
return rake.exitstatus
|
216
|
+
end
|
217
|
+
else
|
218
|
+
puts("rakefile.rb not found in #{work.directory}") if @opts.verbose?
|
219
|
+
return 0
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
223
|
+
0
|
224
|
+
end
|
225
|
+
|
226
|
+
def pull
|
227
|
+
pattern = ""
|
228
|
+
pattern = @opts.arguments[1] if @opts.arguments.length > 1
|
229
|
+
REPOSITORIES.matches(pattern).each do |url|
|
230
|
+
repo = Raykit::Git::Repository.new(url)
|
231
|
+
work = Raykit::Git::Directory.new(repo.get_dev_dir("work"))
|
232
|
+
if Dir.exist?(work.directory) && !work.directory == ".git"
|
233
|
+
Dir.chdir(work.directory) do
|
234
|
+
diff = `git diff`.strip
|
235
|
+
status = `git status`.strip
|
236
|
+
if diff.length.zero? && status.include?("nothing to commit")
|
237
|
+
cmd = Command.new("git pull")
|
238
|
+
cmd.summary if @opts.verbose?
|
239
|
+
|
240
|
+
if cmd.exitstatus != 0
|
241
|
+
cmd.details
|
242
|
+
abort Rainbow(cmd.summary).blue.bright if @opts.quit?
|
243
|
+
end
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
247
|
+
rescue StandardError => e
|
248
|
+
issue = "error occurred for pull of #{url} #{e}"
|
249
|
+
if @opts.quit?
|
250
|
+
abort Rainbow(issue).blue.bright
|
251
|
+
else
|
252
|
+
puts Rainbow(issue).blue.bright
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
def import
|
258
|
+
pattern = ""
|
259
|
+
pattern = @opts.arguments[1] if @opts.arguments.length > 1
|
260
|
+
puts "scanning..."
|
261
|
+
count = REPOSITORIES.length
|
262
|
+
REPOSITORIES.import(pattern)
|
263
|
+
new_count = REPOSITORIES.length - count
|
264
|
+
puts "imported #{new_count} git repositories"
|
265
|
+
end
|
266
|
+
|
267
|
+
def clean
|
268
|
+
pattern = ""
|
269
|
+
pattern = @opts.arguments[1] if @opts.arguments.length > 1
|
270
|
+
REPOSITORIES.matches(pattern).each do |url|
|
271
|
+
repo = Raykit::Git::Repository.new(url)
|
272
|
+
work = Raykit::Git::Directory.new(repo.get_dev_dir("work"))
|
273
|
+
next unless Dir.exist?(work.directory)
|
274
|
+
|
275
|
+
puts "removing #{work.directory}"
|
276
|
+
begin
|
277
|
+
FileUtils.rm_rf(work.directory, secure: true)
|
278
|
+
rescue StandardError
|
279
|
+
puts "error removing #{work.directory}"
|
280
|
+
end
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
def copy
|
285
|
+
if @opts.arguments.length < 3
|
286
|
+
puts "source and destination arguments are required for copy"
|
287
|
+
return 1
|
288
|
+
end
|
289
|
+
source = @opts.arguments[1]
|
290
|
+
dest = @opts.arguments[2]
|
291
|
+
FileUtils.cp(source, dest)
|
292
|
+
puts "copied #{source} to #{dest}"
|
293
|
+
end
|
294
|
+
|
295
|
+
def rake(hash)
|
296
|
+
REPOSITORIES.each do |remote|
|
297
|
+
next unless remote.include?(hash[:pattern])
|
298
|
+
|
299
|
+
begin
|
300
|
+
puts "remote: #{remote}"
|
301
|
+
cmd = Raykit::Rake.run(remote, "master")
|
302
|
+
elapsed_str = Timer.get_elapsed_str(cmd.elapsed)
|
303
|
+
if cmd.exitstatus.zero?
|
304
|
+
puts "#{elapsed_str} #{Rainbow(SECRETS.hide(cmd.command)).yellow.bright} (#{cmd.directory})"
|
305
|
+
else
|
306
|
+
puts "\r\n#{cmd.command}\r\n"
|
307
|
+
puts "\r\n#{cmd.output}\r\n"
|
308
|
+
puts "\r\n#{cmd.error}\r\n"
|
309
|
+
puts ""
|
310
|
+
puts "#{Rainbow(elapsed_str).red.bright} #{Rainbow(cmd.command).white}"
|
311
|
+
end
|
312
|
+
rescue StandardError
|
313
|
+
puts "rescued..."
|
314
|
+
end
|
315
|
+
end
|
316
|
+
end
|
317
|
+
end
|
318
|
+
end
|