raykit 0.0.155 → 0.0.156
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/raykit/command.rb +14 -2
- data/lib/raykit/console.rb +101 -80
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c22306639006c6b9a733187a7e612e30bb5419060524f8e574fbf8d01f992513
|
4
|
+
data.tar.gz: 521fdeb4da6c862c390f760b306d610263feae258711ba5c3c7244f80da1f241
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee6e5ea4e1b61ca976f262c92a14c2b996be2d51be97d5d236c037f8d310d1ad3e352ff8124338246bda37edf2a7c5020d73fb39c4ca3417a1b33b03258841da
|
7
|
+
data.tar.gz: 5c7ecd5116ea2bfc44eb22efa3f1327e78571c2d11a4b5a53eb912297827f7994142f6cd304258381973ae2b34b2b60290e6ed6938a29ed706b23e53de9b29d9
|
data/lib/raykit/command.rb
CHANGED
@@ -99,13 +99,25 @@ module Raykit
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
-
def summary
|
102
|
+
def summary(show_directory=false)
|
103
103
|
checkmark="\u2713"
|
104
104
|
#warning="\u26A0"
|
105
105
|
error="\u0058"
|
106
106
|
symbol=Rainbow(checkmark.encode('utf-8')).green
|
107
107
|
symbol=Rainbow(error.encode('utf-8')).red if(@exitstatus!=0)
|
108
|
-
|
108
|
+
if(show_directory)
|
109
|
+
puts symbol + " " + elapsed_str.rjust(4) + " " + Rainbow(SECRETS.hide(@command)).yellow + " (#{@directory})"
|
110
|
+
else
|
111
|
+
puts symbol + " " + elapsed_str.rjust(4) + " " + Rainbow(SECRETS.hide(@command)).yellow# + " (#{@directory})"
|
112
|
+
end
|
113
|
+
#puts symbol + " " + elapsed_str.rjust(4) + " " + Rainbow(SECRETS.hide(@command)).yellow# + " (#{@directory})"
|
114
|
+
end
|
115
|
+
|
116
|
+
def details
|
117
|
+
#summary
|
118
|
+
puts @output
|
119
|
+
puts @error
|
120
|
+
puts
|
109
121
|
end
|
110
122
|
|
111
123
|
def to_hash()
|
data/lib/raykit/console.rb
CHANGED
@@ -15,7 +15,7 @@ module Raykit
|
|
15
15
|
|
16
16
|
if(opts.verbose?)
|
17
17
|
puts "options: " + Rainbow(@opts.to_hash).yellow.bright
|
18
|
-
puts "arguments:" + Rainbow(@
|
18
|
+
puts "arguments:" + Rainbow(@opts.arguments).yellow.bright
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -130,21 +130,51 @@ module Raykit
|
|
130
130
|
def work
|
131
131
|
pattern=''
|
132
132
|
pattern=@opts.arguments[1] if(@opts.arguments.length > 1)
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
133
|
+
|
134
|
+
work_repositories = REPOSITORIES.matches(pattern)
|
135
|
+
errors=Array.new()
|
136
|
+
puts 'work: found ' + work_repositories.length.to_s + ' matching urls'
|
137
|
+
work_repositories.each{|url|
|
138
|
+
exitstatus = work_url(url)
|
139
|
+
puts ' ' if(@opts.verbose?)
|
140
|
+
return exitstatus if(@opts[:quit] && exitstatus != 0)
|
141
|
+
}
|
142
|
+
0
|
143
|
+
end
|
144
|
+
|
145
|
+
def work_url(url)
|
146
|
+
puts Rainbow(url).yellow.bright
|
147
|
+
repo=Raykit::Git::Repository.new(url)
|
148
|
+
work=Raykit::Git::Directory.new(repo.get_dev_dir('work'))
|
149
|
+
if(!Dir.exist?(work.directory))
|
150
|
+
clone = Command.new("git clone #{url} #{work.directory}")
|
151
|
+
puts clone.summary if(@opts.verbose?)
|
152
|
+
if(clone.exitstatus != 0)
|
153
|
+
clone.details
|
154
|
+
return clone.exitstatus
|
138
155
|
end
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
156
|
+
end
|
157
|
+
if(Dir.exist?(work.directory))
|
158
|
+
Dir.chdir(work.directory) do
|
159
|
+
if(File.exist?('rakefile.rb'))
|
160
|
+
rake = Raykit::Command.new("rake #{@opts[:task]}")
|
161
|
+
#if(rake.exitstatus != 0)
|
162
|
+
# rake.summary true
|
163
|
+
#end
|
164
|
+
rake.summary(true) if(@opts.verbose?) || rake.exitstatus != 0
|
165
|
+
if(rake.exitstatus != 0)
|
166
|
+
#puts 'rake exitstatus = ' + rake.exitstatus.to_s
|
167
|
+
rake.details
|
168
|
+
rake.summary true
|
169
|
+
return rake.exitstatus
|
170
|
+
end
|
171
|
+
else
|
172
|
+
puts('rakefile.rb not found in ' + work.directory)
|
173
|
+
return 1
|
145
174
|
end
|
146
175
|
end
|
147
|
-
|
176
|
+
end
|
177
|
+
return 0
|
148
178
|
end
|
149
179
|
|
150
180
|
def pull
|
@@ -152,41 +182,32 @@ module Raykit
|
|
152
182
|
pattern=@opts.arguments[1] if(@opts.arguments.length > 1)
|
153
183
|
REPOSITORIES.matches(pattern).each{|url|
|
154
184
|
begin
|
155
|
-
puts '.'
|
156
185
|
repo=Raykit::Git::Repository.new(url)
|
157
186
|
work=Raykit::Git::Directory.new(repo.get_dev_dir('work'))
|
158
|
-
if(Dir.exist?(work.directory))
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
if(
|
163
|
-
|
164
|
-
|
165
|
-
puts Rainbow(issue).blue.bright
|
166
|
-
end
|
167
|
-
else
|
168
|
-
Dir.chdir(work.directory) do
|
169
|
-
diff=`git diff`.strip
|
170
|
-
status=`git status`.strip
|
171
|
-
if(diff.length == 0 && status.include?('nothing to commit'))
|
172
|
-
cmd = Command.new('git pull')
|
173
|
-
cmd.summary if(@opts.verbose?)
|
187
|
+
if(Dir.exist?(work.directory) && !work.directory=='.git')
|
188
|
+
Dir.chdir(work.directory) do
|
189
|
+
diff=`git diff`.strip
|
190
|
+
status=`git status`.strip
|
191
|
+
if(diff.length == 0 && status.include?('nothing to commit'))
|
192
|
+
cmd = Command.new('git pull')
|
193
|
+
cmd.summary if(@opts.verbose?)
|
174
194
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
puts
|
180
|
-
if(@opts.quit?)
|
181
|
-
abort Rainbow(elapsed_str).red.bright + " " + Rainbow(cmd.command).white
|
182
|
-
end
|
195
|
+
if(cmd.exitstatus != 0)
|
196
|
+
cmd.details
|
197
|
+
if(@opts.quit?)
|
198
|
+
abort Rainbow(cmd.summary).blue.bright
|
183
199
|
end
|
184
200
|
end
|
185
201
|
end
|
186
202
|
end
|
187
203
|
end
|
188
204
|
rescue => error
|
189
|
-
|
205
|
+
issue = 'error occurred for pull of ' + url +' ' + error.to_s
|
206
|
+
if(@opts.quit?)
|
207
|
+
abort Rainbow(issue).blue.bright
|
208
|
+
else
|
209
|
+
puts Rainbow(issue).blue.bright
|
210
|
+
end
|
190
211
|
end
|
191
212
|
}
|
192
213
|
end
|
@@ -270,52 +291,52 @@ module Raykit
|
|
270
291
|
|
271
292
|
|
272
293
|
# Parses the command line arguments for the Raykit console application
|
273
|
-
class Parser
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
294
|
+
#class Parser
|
295
|
+
# def self.parse(options)
|
296
|
+
# hash=Hash.new
|
297
|
+
# opt_parser = OptionParser.new do |opts|
|
298
|
+
# opts.banner = "Usage: raykit [options]"
|
299
|
+
# opts.on('-l','--list [PATTERN]','list remotes') do |pattern|
|
300
|
+
# hash[:verb]="list"
|
301
|
+
# hash[:pattern]=pattern
|
302
|
+
# return hash
|
303
|
+
# end
|
283
304
|
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
305
|
+
# opts.on('-i','--import','import remotes') do |import|
|
306
|
+
# hash[:verb]="import"
|
307
|
+
# return hash
|
308
|
+
# end
|
288
309
|
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
310
|
+
# opts.on('-r','--rake [PATTERN]','rake [PATTERN]') do |pattern|
|
311
|
+
# hash[:verb]="rake"
|
312
|
+
# if(pattern.nil?)
|
313
|
+
# hash[:pattern] = ''
|
314
|
+
# else
|
315
|
+
# hash[:pattern]=pattern
|
316
|
+
# end
|
317
|
+
# return hash
|
318
|
+
# end
|
298
319
|
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
320
|
+
# opts.on('-w','--work [PATTERN]','work [PATTERN]') do |pattern|
|
321
|
+
# hash[:verb]="work"
|
322
|
+
# if(pattern.nil?)
|
323
|
+
# hash[:pattern] = ''
|
324
|
+
# else
|
325
|
+
# hash[:pattern]=pattern
|
326
|
+
# end
|
327
|
+
# return hash
|
328
|
+
# end
|
308
329
|
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
330
|
+
# opts.on('-h','--help','help') do
|
331
|
+
# puts opts
|
332
|
+
# exit
|
333
|
+
# end
|
334
|
+
# end
|
314
335
|
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
end
|
336
|
+
# opt_parser.parse!(options)
|
337
|
+
# hash
|
338
|
+
# end
|
339
|
+
#end
|
319
340
|
end
|
320
341
|
|
321
342
|
CONSOLE=Raykit::Console.new
|