yk_command 0.4.4 → 0.4.5
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/Gemfile.lock +1 -1
- data/lib/yk_command/commands.rb +61 -45
- data/lib/yk_command/version.rb +1 -1
- 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: fd0728897c8ae743e8ff166940e9536c16dbc034e91892e3aebe58d5b975a6c7
|
4
|
+
data.tar.gz: 1c604dc3e126b38a6eb15543a7653005d14059745a402d46d5d3bee53aa7778a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28135d9a0220d008e6fe59b6cd4d932078373304f443b8bf09080d09d0ccad269f6c6358e7a37e4368d588dfd965b41e0f8e84fa1e5807bcd81c80d3f645eac0
|
7
|
+
data.tar.gz: ea371ab70e6918c906249c40b9237017eb37b477e0e4ededcfbc1afc2793af16add2f7d86c8b179f46562051d89178484176d5e1ab4b64a61a7e6d8d9c580e2f
|
data/Gemfile.lock
CHANGED
data/lib/yk_command/commands.rb
CHANGED
@@ -232,85 +232,101 @@ module YkCommand
|
|
232
232
|
|
233
233
|
def dependency(path = nil)
|
234
234
|
say "\ncurrent working folder: #{path}\n"
|
235
|
-
project_path =''
|
236
|
-
project_name =''
|
235
|
+
project_path = ''
|
236
|
+
project_name = ''
|
237
237
|
begin
|
238
|
-
g = Git.open(path
|
238
|
+
g = Git.open(path)
|
239
239
|
project_path = Pathname.new(g.lib.git_work_dir)
|
240
240
|
project_name = g.config['remote.origin.url'].split('/').last.split('.')[0]
|
241
|
-
rescue
|
242
|
-
say "No .git folder find in #{path} ,skip folder ... ", :yellow
|
243
|
-
say "\n<--\n", :yellow
|
244
|
-
end
|
245
|
-
|
246
|
-
unless project_name.empty?
|
247
|
-
podfiles = Dir.glob("#{path}/**/Podfile")
|
248
|
-
if !podfiles.empty?
|
249
|
-
begin
|
250
|
-
#开始
|
251
|
-
project_path = podfiles[podfiles.length - 1]
|
252
|
-
podfile_dir = "#{Pathname.new(project_path).dirname}"
|
253
|
-
say "start analyze... path contain [Podfile ,Pods/ ,Podfile.lock] is #{podfile_dir}", :green
|
254
|
-
|
255
|
-
result = Analyzer.new.analyze(podfile_dir)
|
256
241
|
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
if
|
267
|
-
say "
|
268
|
-
|
242
|
+
unless project_name.empty?
|
243
|
+
podfiles = Dir.glob("#{path}/**/Podfile")
|
244
|
+
if !podfiles.empty?
|
245
|
+
begin
|
246
|
+
project_path = podfiles[podfiles.length - 1]
|
247
|
+
podfile_dir = Pathname.new(project_path).dirname.to_s
|
248
|
+
say "start analyze... path contain [Podfile ,Pods/ ,Podfile.lock] is #{podfile_dir} \n ", :green
|
249
|
+
result = Analyzer.new.analyze(podfile_dir)
|
250
|
+
app_info = Request.new.get_project_info(project_name)
|
251
|
+
if app_info['id']
|
252
|
+
say "uploading dependencies for project #{project_name} ..."
|
253
|
+
upload_res = Request.new.upload_app_dependency(app_info['id'], result)
|
254
|
+
if upload_res['code'] == 0
|
255
|
+
say 'uploaded , finished ', :green
|
256
|
+
say "\n<-- \n"
|
257
|
+
{ 'code' => '0', 'name' => project_name }
|
258
|
+
else
|
259
|
+
say "Error :upload dependencies for project #{project_name} - #{app_info["id"]} failed ", :red
|
260
|
+
say "\n<-- \n"
|
261
|
+
{ 'code' => '1', 'name' => project_name }
|
262
|
+
end
|
269
263
|
else
|
270
|
-
say "Error :
|
264
|
+
say "Error :Get App project ID failed , #{project_name}", :red
|
271
265
|
say "\n<-- \n"
|
266
|
+
{ 'code' => '1', 'name' => project_name }
|
272
267
|
end
|
273
268
|
|
274
|
-
|
275
|
-
say "Error :
|
269
|
+
rescue
|
270
|
+
say "Error : #{$!}", :red
|
271
|
+
say "Error : #{ $@}", :red
|
272
|
+
say "Skip folder : #{podfile_dir} ", :red
|
276
273
|
say "\n<-- \n"
|
274
|
+
{ 'code' => '1', 'name' => project_name }
|
277
275
|
end
|
278
276
|
|
279
|
-
|
280
|
-
|
281
|
-
say "Error : #{$!.to_s}", :red
|
282
|
-
say "Error : #{ $@.to_s}", :red
|
283
|
-
say "Skip folder : #{podfile_dir} ", :red
|
277
|
+
else
|
278
|
+
say "No podfile find ,Skip folder : #{project_name} ", :yellow
|
284
279
|
say "\n<-- \n"
|
285
|
-
|
280
|
+
{ 'code' => '2', 'name' => '' }
|
281
|
+
end
|
286
282
|
|
287
|
-
else
|
288
|
-
say "No podfile find ,Skip folder : #{project_name} ", :yellow
|
289
|
-
say "\n<-- \n"
|
290
283
|
end
|
291
284
|
|
285
|
+
rescue
|
286
|
+
say "No .git folder find in #{path} ,skip folder ... ", :yellow
|
287
|
+
say "\n<--\n", :yellow
|
288
|
+
{ 'code' => '2', 'name' => '' }
|
292
289
|
end
|
293
290
|
|
294
291
|
end
|
295
292
|
|
296
|
-
|
297
293
|
desc 'workspace_analyze <AppHost Path>', '遍历项目目录 批量上传项目依赖信息'
|
298
294
|
method_option :workspace_analyze, aliases: '-w'
|
299
295
|
|
300
296
|
def workspace_analyze(path = nil)
|
301
297
|
Dir.chdir(path)
|
302
|
-
subdir_list = Dir[
|
298
|
+
subdir_list = Dir['*'].reject { |o| not File.directory?(o) }
|
303
299
|
say "Start in Workspace : #{path} ...", :yellow
|
304
300
|
subdir_list.each do |project_dir|
|
305
301
|
say "\n#{Pathname.new(project_dir).split[1]} ", :yellow
|
306
302
|
end
|
307
303
|
say "\n ... start scanning to analyze ...\n\n"
|
308
304
|
|
305
|
+
success_count = 0
|
306
|
+
success_name_list = []
|
307
|
+
failed_count = 0
|
308
|
+
failed_name_list = []
|
309
|
+
skip_count = 0
|
310
|
+
|
309
311
|
subdir_list.each { |project_dir|
|
310
312
|
project_path = "#{path}/#{project_dir}"
|
311
|
-
dependency project_path
|
313
|
+
res = dependency project_path
|
314
|
+
if res['code'] == '0'
|
315
|
+
success_count += 1
|
316
|
+
success_name_list << res['name']
|
317
|
+
elsif res['code'] == '1'
|
318
|
+
failed_count += 1
|
319
|
+
failed_name_list << res['name']
|
320
|
+
else
|
321
|
+
skip_count += 1
|
322
|
+
end
|
312
323
|
}
|
313
324
|
|
325
|
+
say "\nworkspace analyze done ! ..."
|
326
|
+
say "success:#{success_count},#{success_name_list}", :green
|
327
|
+
say "failed :#{failed_count},#{failed_name_list}", :red
|
328
|
+
say "skip :#{skip_count}", :yellow
|
329
|
+
|
314
330
|
end
|
315
331
|
|
316
332
|
end
|
data/lib/yk_command/version.rb
CHANGED