yk_command 0.5.6 → 0.5.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/.idea/sonarlint/issuestore/0/d/0d7a5f844cb7a763c4b02c8788a45a497537e9d4 +0 -0
  3. data/.idea/sonarlint/issuestore/1/9/19beed89439e4bbf29ca633ebffb0979a334a05d +0 -0
  4. data/.idea/sonarlint/issuestore/2/2/2264693887a1513e6c4ed16a6231e00d3045ec4e +0 -0
  5. data/.idea/sonarlint/issuestore/2/4/2461a61a84d866812e64ff95d40bd7836fb136ea +0 -0
  6. data/.idea/sonarlint/issuestore/2/e/2e113f2d3dc9bee6a98073d85966fbd9773c044f +0 -0
  7. data/.idea/sonarlint/issuestore/3/4/3423fb39097dbf652818678b749434eb36867bdf +0 -0
  8. data/.idea/sonarlint/issuestore/4/4/44b7fa1ba50397e71d88bd69389f1ec917165cfb +0 -0
  9. data/.idea/sonarlint/issuestore/4/6/460ee6442cf29ef54774da00475d1b5a4bd35a75 +0 -0
  10. data/.idea/sonarlint/issuestore/5/1/512554f10221132e2995f116a1bc380edc569ec4 +0 -0
  11. data/.idea/sonarlint/issuestore/6/e/6e1b71034e8e2f84d8f8236b269fef92a4a51797 +0 -0
  12. data/.idea/sonarlint/issuestore/7/1/71fc201a1096db97453882ad1da5120a71f77bb5 +0 -0
  13. data/.idea/sonarlint/issuestore/7/e/7ed8a0c3d2507e911337de44fdef07f89e35091a +0 -0
  14. data/.idea/sonarlint/issuestore/9/5/95a45210972238034e9fed522811176fe20117d3 +0 -0
  15. data/.idea/sonarlint/issuestore/9/7/97c2c9c7adeb7fa2e6ffbf07cba2418868ac9739 +0 -0
  16. data/.idea/sonarlint/issuestore/9/a/9ac8606ab5816ca6769cd53216a107d7d06ca971 +0 -0
  17. data/.idea/sonarlint/issuestore/a/6/a67e5ecfa13044750ab8599881f66237821a8b38 +0 -0
  18. data/.idea/sonarlint/issuestore/a/7/a7f1546c0b6a93fd23b7fc1506b2eb0d13e011c2 +0 -0
  19. data/.idea/sonarlint/issuestore/a/d/ad7bffefc6248a8f673a10e668a82bdbbe38a3e3 +0 -0
  20. data/.idea/sonarlint/issuestore/b/a/ba47c112fc95dd748a99abb0290610022df254a7 +0 -0
  21. data/.idea/sonarlint/issuestore/b/e/be2bfbadd6efe69882507c3a03b1b96c46f3dcbe +0 -0
  22. data/.idea/sonarlint/issuestore/c/f/cf949c4c054253d95250aa9644f2b805b2aa0d2a +0 -0
  23. data/.idea/sonarlint/issuestore/d/5/d594a688a538c9bebe38deb974bd46055c65a93c +0 -0
  24. data/.idea/sonarlint/issuestore/d/e/de3150c01c3a946a6168173c4116741379fe3579 +0 -0
  25. data/.idea/sonarlint/issuestore/e/5/e5580d669a0c327c5b0897ba7dd8465a3d4db45a +0 -0
  26. data/.idea/sonarlint/issuestore/e/e/ee825dc90668e04039ee525c5858c5736562c9f5 +0 -0
  27. data/.idea/sonarlint/issuestore/f/6/f6e109e4c314cef09022792f4b88dd267a682d28 +3 -0
  28. data/.idea/sonarlint/issuestore/index.pb +53 -0
  29. data/.idea/yk_command.iml +5 -5
  30. data/Gemfile.lock +2 -2
  31. data/lib/yk_command/analyze/analyze.rb +1 -1
  32. data/lib/yk_command/analyze/request.rb +11 -6
  33. data/lib/yk_command/commands.rb +31 -1
  34. data/lib/yk_command/component_manage/component_manage_platform.rb +73 -4
  35. data/lib/yk_command/gitlab/yk_gitlab.rb +23 -2
  36. data/lib/yk_command/module/module_handler.rb +1 -4
  37. data/lib/yk_command/module/yk_module.rb +57 -63
  38. data/lib/yk_command/project/YKProjectTemplate/NAME.podspec +142 -18
  39. data/lib/yk_command/project/setup/ConfigureSwift.rb +2 -0
  40. data/lib/yk_command/project/setup/TemplateConfigurator.rb +10 -5
  41. data/lib/yk_command/project/simple_project_template/.gitignore +37 -0
  42. data/lib/yk_command/project/simple_project_template/CODE_OF_CONDUCT.md +40 -0
  43. data/lib/yk_command/project/simple_project_template/LICENSE +21 -0
  44. data/lib/yk_command/project/simple_project_template/NAME-osx.podspec +43 -0
  45. data/lib/yk_command/project/simple_project_template/NAME.podspec +140 -0
  46. data/lib/yk_command/project/simple_project_template/POD_LICENSE +19 -0
  47. data/lib/yk_command/project/simple_project_template/POD_README.md +29 -0
  48. data/lib/yk_command/project/simple_project_template/Pod/Assets/.gitkeep +0 -0
  49. data/lib/yk_command/project/simple_project_template/Pod/Classes/.gitkeep +0 -0
  50. data/lib/yk_command/project/simple_project_template/README.md +22 -0
  51. data/lib/yk_command/project/simple_project_template/configure +13 -0
  52. data/lib/yk_command/project/simple_project_template/templates/ios/Example/PROJECT/Base.lproj/LaunchScreen.storyboard +31 -0
  53. data/lib/yk_command/project/simple_project_template/templates/ios/Example/PROJECT/Base.lproj/Main.storyboard +79 -0
  54. data/lib/yk_command/project/simple_project_template/templates/ios/Example/PROJECT/CPDAppDelegate.h +15 -0
  55. data/lib/yk_command/project/simple_project_template/templates/ios/Example/PROJECT/CPDAppDelegate.m +46 -0
  56. data/lib/yk_command/project/simple_project_template/templates/ios/Example/PROJECT/CPDViewController.h +13 -0
  57. data/lib/yk_command/project/simple_project_template/templates/ios/Example/PROJECT/CPDViewController.m +37 -0
  58. data/lib/yk_command/project/simple_project_template/templates/ios/Example/PROJECT/Images.xcassets/AppIcon.appiconset/Contents.json +98 -0
  59. data/lib/yk_command/project/simple_project_template/templates/ios/Example/PROJECT/PROJECT-Info.plist +49 -0
  60. data/lib/yk_command/project/simple_project_template/templates/ios/Example/PROJECT/PROJECT-Prefix.pch +16 -0
  61. data/lib/yk_command/project/simple_project_template/templates/ios/Example/PROJECT/en.lproj/InfoPlist.strings +2 -0
  62. data/lib/yk_command/project/simple_project_template/templates/ios/Example/PROJECT/main.m +17 -0
  63. data/lib/yk_command/project/simple_project_template/templates/ios/Example/PROJECT.xcodeproj/project.pbxproj +500 -0
  64. data/lib/yk_command/project/simple_project_template/templates/ios/Example/PROJECT.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  65. data/lib/yk_command/project/simple_project_template/templates/ios/Example/PROJECT.xcodeproj/xcshareddata/xcschemes/PROJECT.xcscheme +101 -0
  66. data/lib/yk_command/project/simple_project_template/templates/ios/Example/Podfile +19 -0
  67. data/lib/yk_command/project/simple_project_template/templates/ios/Example/Tests/Tests-Info.plist +22 -0
  68. data/lib/yk_command/project/simple_project_template/templates/ios/Example/Tests/Tests-Prefix.pch +7 -0
  69. data/lib/yk_command/project/simple_project_template/templates/ios/Example/Tests/Tests.m +9 -0
  70. data/lib/yk_command/project/simple_project_template/templates/ios/Example/Tests/en.lproj/InfoPlist.strings +2 -0
  71. data/lib/yk_command/project/simple_project_template/templates/macos-swift/Example/PROJECT/AppDelegate.swift +26 -0
  72. data/lib/yk_command/project/simple_project_template/templates/macos-swift/Example/PROJECT/Assets.xcassets/AppIcon.appiconset/Contents.json +58 -0
  73. data/lib/yk_command/project/simple_project_template/templates/macos-swift/Example/PROJECT/Base.lproj/Main.storyboard +717 -0
  74. data/lib/yk_command/project/simple_project_template/templates/macos-swift/Example/PROJECT/Info.plist +30 -0
  75. data/lib/yk_command/project/simple_project_template/templates/macos-swift/Example/PROJECT/PROJECT.entitlements +10 -0
  76. data/lib/yk_command/project/simple_project_template/templates/macos-swift/Example/PROJECT/ViewController.swift +27 -0
  77. data/lib/yk_command/project/simple_project_template/templates/macos-swift/Example/PROJECT.xcodeproj/project.pbxproj +444 -0
  78. data/lib/yk_command/project/simple_project_template/templates/macos-swift/Example/PROJECT.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  79. data/lib/yk_command/project/simple_project_template/templates/macos-swift/Example/PROJECT.xcodeproj/xcshareddata/xcschemes/PROJECT.xcscheme +103 -0
  80. data/lib/yk_command/project/simple_project_template/templates/macos-swift/Example/Podfile +11 -0
  81. data/lib/yk_command/project/simple_project_template/templates/macos-swift/Example/Tests/Info.plist +22 -0
  82. data/lib/yk_command/project/simple_project_template/templates/macos-swift/Example/Tests/Tests.swift +1 -0
  83. data/lib/yk_command/project/simple_project_template/templates/swift/Example/PROJECT/AppDelegate.swift +46 -0
  84. data/lib/yk_command/project/simple_project_template/templates/swift/Example/PROJECT/Base.lproj/LaunchScreen.xib +46 -0
  85. data/lib/yk_command/project/simple_project_template/templates/swift/Example/PROJECT/Base.lproj/Main.storyboard +86 -0
  86. data/lib/yk_command/project/simple_project_template/templates/swift/Example/PROJECT/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  87. data/lib/yk_command/project/simple_project_template/templates/swift/Example/PROJECT/Info.plist +39 -0
  88. data/lib/yk_command/project/simple_project_template/templates/swift/Example/PROJECT/ViewController.swift +30 -0
  89. data/lib/yk_command/project/simple_project_template/templates/swift/Example/PROJECT.xcodeproj/project.pbxproj +468 -0
  90. data/lib/yk_command/project/simple_project_template/templates/swift/Example/PROJECT.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  91. data/lib/yk_command/project/simple_project_template/templates/swift/Example/PROJECT.xcodeproj/xcshareddata/xcschemes/PROJECT.xcscheme +117 -0
  92. data/lib/yk_command/project/simple_project_template/templates/swift/Example/Podfile +20 -0
  93. data/lib/yk_command/project/simple_project_template/templates/swift/Example/Tests/Info.plist +24 -0
  94. data/lib/yk_command/project/simple_project_template/templates/swift/Example/Tests/Tests.swift +1 -0
  95. data/lib/yk_command/project/yk_project.rb +14 -9
  96. data/lib/yk_command/version.rb +1 -1
  97. metadata +82 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70d1d7a508e7e09d31ac986c323ad6f310d57ae896f8127c032c69c2b706abb5
4
- data.tar.gz: 84ab9862a0869edf6651d08a532ac1605695e45e39c55fa016c1c3299618f1a9
3
+ metadata.gz: 0a174602b70774ab3f35c810d52f7bcd4c9ecc5005f36a8394fcb5c484be93d0
4
+ data.tar.gz: ec8f4b4b03d110c21cf4a6f35d27c40abcfdfdeede658ad8b96746cee0a9348d
5
5
  SHA512:
6
- metadata.gz: a166e1914e2c2ce43dbcb69d5c79095cd54074c5ca1e196c0668ec0c5f6c840ebfbc7efa4010d6ba165588c7f5392230a4a9f5dca03dded5c501477d20aaede2
7
- data.tar.gz: 26bfdaf1ac131b2384721e3bac97638a37d20e52ee6849b0f358ba82dfb7f6f3f26168e3ab1a07dbf51bac3c082370217b5e13ba7c5b1fd17017a3773ad7cf51
6
+ metadata.gz: 66f39fd20340b20713ccde71e70ac289c54e90a1c959f9306e3e6736edbd83dc56d851e1df920b2d20841700944b81490d1116406536219c5af340850a38c054
7
+ data.tar.gz: 44f63546db7556afaa905f371281993d3cb3602422997efd8f43be3431da01119ef270348a96fb85a2b75098cde5dbc43f7832a887acdd78ecf737df655c9049
@@ -0,0 +1,3 @@
1
+
2
+ e
3
+ ruby:S1192e"JDefine a constant instead of duplicating this literal "/PROJECT/" 4 times.(���������
@@ -0,0 +1,53 @@
1
+
2
+ 8
3
+ Rakefile,4/4/44b7fa1ba50397e71d88bd69389f1ec917165cfb
4
+ [
5
+ +lib/yk_command/project/setup/MessageBank.rb,e/e/ee825dc90668e04039ee525c5858c5736562c9f5
6
+ ^
7
+ .lib/yk_command/project/setup/ConfigureSwift.rb,a/7/a7f1546c0b6a93fd23b7fc1506b2eb0d13e011c2
8
+ \
9
+ ,lib/yk_command/project/setup/ConfigureiOS.rb,c/f/cf949c4c054253d95250aa9644f2b805b2aa0d2a
10
+ b
11
+ 2lib/yk_command/project/setup/ProjectManipulator.rb,f/6/f6e109e4c314cef09022792f4b88dd267a682d28
12
+ v
13
+ Flib/yk_command/project/YKProjectTemplate/templates/ios/Example/Podfile,a/d/ad7bffefc6248a8f673a10e668a82bdbbe38a3e3
14
+ x
15
+ Hlib/yk_command/project/YKProjectTemplate/templates/swift/Example/Podfile,7/e/7ed8a0c3d2507e911337de44fdef07f89e35091a
16
+ ~
17
+ Nlib/yk_command/project/YKProjectTemplate/templates/macos-swift/Example/Podfile,2/2/2264693887a1513e6c4ed16a6231e00d3045ec4e
18
+ d
19
+ 4lib/yk_command/module/template/objc/PrefixHeader.pch,1/9/19beed89439e4bbf29ca633ebffb0979a334a05d
20
+ b
21
+ 2lib/yk_command/module/template/objc/RouterDefine.h,a/6/a67e5ecfa13044750ab8599881f66237821a8b38
22
+ a
23
+ 1lib/yk_command/module/template/objc/ToolsHeader.h,9/a/9ac8606ab5816ca6769cd53216a107d7d06ca971
24
+ b
25
+ 2lib/yk_command/module/template/objc/VendorHeader.h,b/e/be2bfbadd6efe69882507c3a03b1b96c46f3dcbe
26
+ d
27
+ 4lib/yk_command/module/template/objc/RouterRegister.h,4/6/460ee6442cf29ef54774da00475d1b5a4bd35a75
28
+ e
29
+ 5lib/yk_command/module/template/objc/ServiceProtocol.h,b/a/ba47c112fc95dd748a99abb0290610022df254a7
30
+ e
31
+ 5lib/yk_command/module/template/objc/ServiceRegister.h,3/4/3423fb39097dbf652818678b749434eb36867bdf
32
+ e
33
+ 5lib/yk_command/module/template/objc/ServiceRegister.m,0/d/0d7a5f844cb7a763c4b02c8788a45a497537e9d4
34
+ �
35
+ Zlib/yk_command/project/YKProjectTemplate/templates/ios/Example/PROJECT/CPDViewController.m,e/5/e5580d669a0c327c5b0897ba7dd8465a3d4db45a
36
+ �
37
+ ]lib/yk_command/project/YKProjectTemplate/templates/swift/Example/PROJECT/ViewController.swift,7/1/71fc201a1096db97453882ad1da5120a71f77bb5
38
+ �
39
+ Wlib/yk_command/project/YKProjectTemplate/templates/ios/Example/PROJECT/CPDAppDelegate.m,2/e/2e113f2d3dc9bee6a98073d85966fbd9773c044f
40
+ d
41
+ 4lib/yk_command/module/template/objc/CategoryHeader.h,6/e/6e1b71034e8e2f84d8f8236b269fef92a4a51797
42
+ d
43
+ 4lib/yk_command/module/template/objc/RouterRegister.m,d/5/d594a688a538c9bebe38deb974bd46055c65a93c
44
+ g
45
+ 7lib/yk_command/module/template/swift/RouterDefine.swift,5/1/512554f10221132e2995f116a1bc380edc569ec4
46
+ 7
47
+ Gemfile,d/e/de3150c01c3a946a6168173c4116741379fe3579
48
+ i
49
+ 9lib/yk_command/project/YKProjectTemplate/NAME-osx.podspec,9/7/97c2c9c7adeb7fa2e6ffbf07cba2418868ac9739
50
+ e
51
+ 5lib/yk_command/project/YKProjectTemplate/NAME.podspec,9/5/95a45210972238034e9fed522811176fe20117d3
52
+ b
53
+ 2lib/yk_command/project/YKProjectTemplate/README.md,2/4/2461a61a84d866812e64ff95d40bd7836fb136ea
data/.idea/yk_command.iml CHANGED
@@ -80,21 +80,21 @@
80
80
  <option name="myRootTask">
81
81
  <RakeTaskImpl id="rake">
82
82
  <subtasks>
83
- <RakeTaskImpl description="Build yk_command-0.5.0.gem into the pkg directory" fullCommand="build" id="build" />
83
+ <RakeTaskImpl description="Build yk_command-0.5.7.gem into the pkg directory" fullCommand="build" id="build" />
84
84
  <RakeTaskImpl id="build">
85
85
  <subtasks>
86
- <RakeTaskImpl description="Generate SHA512 checksum if yk_command-0.5.0.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
86
+ <RakeTaskImpl description="Generate SHA512 checksum if yk_command-0.5.7.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
87
87
  </subtasks>
88
88
  </RakeTaskImpl>
89
89
  <RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
90
90
  <RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
91
- <RakeTaskImpl description="Build and install yk_command-0.5.0.gem into system gems" fullCommand="install" id="install" />
91
+ <RakeTaskImpl description="Build and install yk_command-0.5.7.gem into system gems" fullCommand="install" id="install" />
92
92
  <RakeTaskImpl id="install">
93
93
  <subtasks>
94
- <RakeTaskImpl description="Build and install yk_command-0.5.0.gem into system gems without network access" fullCommand="install:local" id="local" />
94
+ <RakeTaskImpl description="Build and install yk_command-0.5.7.gem into system gems without network access" fullCommand="install:local" id="local" />
95
95
  </subtasks>
96
96
  </RakeTaskImpl>
97
- <RakeTaskImpl description="Create tag v0.5.0 and build and push yk_command-0.5.0.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
97
+ <RakeTaskImpl description="Create tag v0.5.7 and build and push yk_command-0.5.7.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
98
98
  <RakeTaskImpl description="" fullCommand="default" id="default" />
99
99
  <RakeTaskImpl description="" fullCommand="release" id="release" />
100
100
  <RakeTaskImpl id="release">
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yk_command (0.5.6)
4
+ yk_command (0.5.9)
5
5
  bundler
6
6
  cocoapods
7
7
  cocoapods-core
@@ -135,7 +135,7 @@ GEM
135
135
  parser (>= 3.1.1.0)
136
136
  ruby-macho (2.5.1)
137
137
  ruby-progressbar (1.11.0)
138
- rubyzip (2.3.0)
138
+ rubyzip (2.3.2)
139
139
  thor (1.2.1)
140
140
  typhoeus (1.4.0)
141
141
  ethon (>= 0.9.0)
@@ -123,7 +123,7 @@ module YkCommand
123
123
  say "failed :#{failed_count},#{failed_name_list}", :red
124
124
  say "skip :#{skip_count}", :yellow
125
125
 
126
- bot_message path ,success_name_list,failed_name_list
126
+ # bot_message path ,success_name_list,failed_name_list
127
127
 
128
128
  end
129
129
 
@@ -2,30 +2,35 @@ require 'httparty'
2
2
  module YkCommand
3
3
  class Request
4
4
 
5
- include HTTParty
5
+ include HTTParty
6
6
 
7
7
  headers 'Content-Type' => 'application/json'
8
8
 
9
9
  def initialize(config)
10
10
  @config = config
11
11
  self.class.base_uri @config[:pro]
12
+ puts "🍉 #{self.class.base_uri}"
12
13
  end
13
14
 
14
- def upload_app_dependency(project_id,data)
15
+ def upload_app_dependency(project_id, data)
15
16
 
16
- self.class.post('/dependency/addDependency', query: { "projectId" => project_id },body: data)
17
+ self.class.post('/dependency/addDependency', query: { "projectId" => project_id }, body: data)
17
18
  end
18
19
 
19
20
  def get_project_info(app_project_name)
20
- self.class.get('/project/projectByName', query: { "name" => app_project_name } )
21
+ self.class.get('/project/projectByName', query: { "name" => app_project_name })
21
22
  end
22
23
 
23
24
  def upload_app(app_list_data)
24
- self.class.post('/project/updateAllAppProjects',body: {'data' => app_list_data}.to_json)
25
+ self.class.post('/project/updateAllAppProjects', body: { 'data' => app_list_data }.to_json)
25
26
  end
26
27
 
27
28
  def upload_component(data)
28
- self.class.post('/project/updateAllComponents',body: {'data' => data}.to_json)
29
+ self.class.post('/project/updateAllComponents', body: { 'data' => data }.to_json)
30
+ end
31
+
32
+ def upload_third_lib_project(data)
33
+ self.class.post('/project/updateAllComponents', body: { 'data' => data }.to_json)
29
34
  end
30
35
 
31
36
  end
@@ -23,7 +23,14 @@ module YkCommand
23
23
  method_option :create, aliases: '-c'
24
24
 
25
25
  def create(path = nil)
26
- YkModule.new(self .args,self .options ).create(path)
26
+ YkModule.new(self .args,self .options ).create(path,false )
27
+ end
28
+
29
+ desc 'create_simple_project <Path>', '在某个路径下交互式生成一个简单的demo项目'
30
+ method_option :create, aliases: '-c'
31
+
32
+ def create_simple_project(path = nil)
33
+ YkModule.new(self .args,self .options ).create(path,true )
27
34
  end
28
35
 
29
36
  desc 'dependency <Podfile.lock Path>', '解析Podfile.lock'
@@ -51,6 +58,29 @@ module YkCommand
51
58
 
52
59
  end
53
60
 
61
+ desc 'platform_create_component ', '创建新的公共组件'
62
+ method_option :platform_create_component, aliases: '-pcc'
63
+
64
+ def platform_create_component(path = nil,name,desc)
65
+ p = ComponentManagePlatform.new
66
+ p.create_new_component(name,desc)
67
+
68
+ end
69
+
70
+ desc 'platform_delete_component ', '删除YKComponents下的组件'
71
+ method_option :platform_delete_component, aliases: '-pcc'
72
+
73
+ def platform_delete_component(name)
74
+ p = ComponentManagePlatform.new
75
+ p.delete_component(name)
76
+
77
+ end
78
+
79
+
80
+
81
+
82
+
83
+
54
84
 
55
85
  end
56
86
  end
@@ -1,5 +1,3 @@
1
-
2
-
3
1
  require 'yk_command/gitlab/yk_gitlab'
4
2
  require 'yk_command/analyze/request'
5
3
  require 'yk_command/config/yk_config'
@@ -14,24 +12,95 @@ module YkCommand
14
12
  def initialize
15
13
  path = __dir__
16
14
  config = YkConfig.new path
17
- @gitlab_srvice =YkGitlab.new(config.read_config GITLAB_CONFIG_FILE)
15
+ @gitlab_srvice = YkGitlab.new(config.read_config GITLAB_CONFIG_FILE)
18
16
  @api_service = Request.new(config.read_config SERVER_ENV_CONFIG_FILE)
19
17
  end
20
18
 
21
19
  def update_app_data
22
20
  data = @gitlab_srvice.get_all_app
23
21
  list = data.parsed_response['shared_projects']
24
-
22
+ list.each do |project |
23
+ committers = [];
24
+ commits = @gitlab_srvice.get_project_commits(project["id"],0 ,50 )
25
+ commits.each do |commit|
26
+ committers.push(commit["committer_name"])
27
+ end
28
+ project["committers"] = committers.uniq
29
+ end
25
30
  r = @api_service.upload_app(list)
26
31
  pp r
27
32
  end
28
33
 
29
34
  def update_component_data
30
35
  data = @gitlab_srvice.get_all_components
36
+
31
37
  list = data.parsed_response['projects']
38
+
39
+
40
+
41
+ list.each do |project |
42
+ committers = [];
43
+ commits = @gitlab_srvice.get_project_commits(project["id"],0 ,50 )
44
+
45
+
46
+ commits.each do |commit|
47
+ committers.push(commit["committer_name"])
48
+ end
49
+ project["committers"] = committers.uniq
50
+ end
51
+
32
52
  r = @api_service.upload_component(list)
33
53
  pp r
34
54
  end
55
+
56
+ def update_third_lib_data
57
+ data = @gitlab_srvice.get_third_party_lib_projects
58
+ list = data.parsed_response['projects']
59
+ r = @api_service.upload_third_lib_project(list)
60
+ pp r
61
+ end
62
+
63
+ def create_new_component(name, desc)
64
+ r = @gitlab_srvice.create_project(name, desc)
65
+ if r.response.code == "201"
66
+ pp "创建成功"
67
+ url = r.parsed_response["http_url_to_repo"]
68
+ pp "repo url :#{url}"
69
+ else
70
+ pp "创建失败"
71
+ pp r.parsed_response['message']
72
+ end
73
+
74
+ end
75
+
76
+ def find_project(name)
77
+ r = @gitlab_srvice.search_project(name)
78
+ end
79
+
80
+ def delete_component(name)
81
+
82
+ res = find_project(name)
83
+ id = 0
84
+ res.each do |project_hash|
85
+ if project_hash["namespace"]["id"] == 514 && project_hash["name"] == name
86
+ id = project_hash['id']
87
+ end
88
+ end
89
+
90
+ if id == 0
91
+ pp '未找到相关的工程'
92
+ end
93
+ r = @gitlab_srvice.delete_project(id) unless id == 0
94
+
95
+ if r != nil
96
+ if r.code == 200
97
+ pp "#{name} 成功删除"
98
+ else
99
+ pp "#{name} 删除失败,"
100
+ end
101
+ end
102
+ end
103
+
35
104
  end
36
105
 
37
106
  end
@@ -26,15 +26,36 @@ module YkCommand
26
26
 
27
27
  end
28
28
 
29
-
29
+ def get_third_party_lib_projects
30
+ get_group_projects 873,100,0
31
+ end
30
32
 
31
33
  def get_group_projects(group_id,per_page,page)
32
34
  self.class.get("/groups/#{group_id}", query: { "private_token" => @token,"per_page"=> per_page,"page"=> page })
33
35
  end
34
36
 
35
- end
37
+ def create_project(name,description)
38
+ self.class.post("/projects", query: { "private_token" => @token },body:{"name" => name,"namespace_id" => 514,"description" => description}.to_json)
39
+
40
+ end
41
+
42
+ def get_project_commits(project_id,page,per_page)
36
43
 
44
+ self.class.get("/projects/#{project_id}/repository/commits", query: { "private_token" => @token,"per_page"=> per_page,"page"=> page })
37
45
 
46
+ end
38
47
 
48
+ def search_project(name)
49
+ self.class.get("/projects", query: { "private_token" => @token,"search":name} )
50
+ end
51
+
52
+ def delete_project(id)
53
+ self.class.delete("/projects/#{id}", query: { "private_token" => @token })
54
+
55
+ end
56
+
57
+
58
+
59
+ end
39
60
 
40
61
  end
@@ -106,10 +106,7 @@ module YkCommand
106
106
  template source, final_file
107
107
  end
108
108
 
109
- Dir.chdir("#{@final_path}/Example") do
110
- system 'pod install'
111
- system "open './#{@name}.xcworkspace'"
112
- end
109
+
113
110
  end
114
111
 
115
112
  end
@@ -1,4 +1,3 @@
1
-
2
1
  require 'colored'
3
2
  require 'fileutils'
4
3
  require 'psych'
@@ -37,14 +36,12 @@ module YkCommand
37
36
  if File.exist?(@final_path.to_s)
38
37
  say "#{@final_path} 已存在:", :red
39
38
  else
40
- construct_project path
41
-
39
+ construct_project path, false
42
40
 
43
41
  end
44
42
  end
45
43
 
46
-
47
- def read_user_input(desc,ask_prom,now_value,limit)
44
+ def read_user_input(desc, ask_prom, now_value, limit)
48
45
  item = ''
49
46
  say "#{desc}:", :green
50
47
 
@@ -53,19 +50,18 @@ module YkCommand
53
50
  if input != ''
54
51
  item = input
55
52
  else
56
- if now_value!=nil && now_value != ''
53
+ if now_value != nil && now_value != ''
57
54
  item = now_value
58
55
  else
59
- say "请正确填写#{desc}",:red
60
- item = read_user_input(desc,ask_prom,now_value,limit)
56
+ say "请正确填写#{desc}", :red
57
+ item = read_user_input(desc, ask_prom, now_value, limit)
61
58
  end
62
59
 
63
60
  end
64
61
  item
65
62
  end
66
63
 
67
-
68
- def create(path = nil)
64
+ def create(path = nil, simple)
69
65
 
70
66
  path = Dir.pwd if path.nil?
71
67
 
@@ -73,16 +69,16 @@ module YkCommand
73
69
 
74
70
  config = File.exist?(config_file_path) ? YAML.load_file(config_file_path) : {}
75
71
 
76
- project = read_user_input('模块名',"Project name",config[:project],nil )
72
+ project = read_user_input('模块名', "Project name", config[:project], nil)
77
73
  config[:project] = project
78
74
 
79
- language = read_user_input('语言',"Project language",config[:language], ['objc', 'swift', ''] )
75
+ language = read_user_input('语言', "Project language", config[:language], ['objc', 'swift', ''])
80
76
  config[:language] = language
81
77
 
82
- class_prefix = read_user_input('类名前缀',"Class prefix",config[:class_prefix],nil )
78
+ class_prefix = read_user_input('类名前缀', "Class prefix", config[:class_prefix], nil)
83
79
  config[:class_prefix] = class_prefix
84
80
 
85
- author = read_user_input('文件作者',"Author",config[:author],nil)
81
+ author = read_user_input('文件作者', "Author", config[:author], nil)
86
82
  config[:author] = author
87
83
 
88
84
  # Dir.chdir(path)
@@ -98,33 +94,36 @@ module YkCommand
98
94
  @date = Time.now.strftime('%d/%m/%y')
99
95
  @lang = config[:language]
100
96
 
97
+ construct_project path, simple
101
98
 
102
- construct_project path
103
-
104
- end
99
+ end
105
100
 
106
- def construct_project(path)
101
+ def construct_project(path, is_simple)
107
102
  final_path = "#{path}/#{@name}"
108
103
 
109
104
  if File.exist?(final_path.to_s)
110
105
  say "#{final_path} 已存在:", :red
111
106
  else
112
107
 
113
- YkProject.new.prepare_project(@name,@platform,@class_prefix,@author,path)
108
+ YkProject.new(is_simple).prepare_project(@name, @lang, @class_prefix, @author, path)
114
109
  config = {}
115
- config[:final_path] = final_path
116
- config[:name] = @name
117
- config[:project] = @project
118
- config[:prefixed_module] = @prefixed_module
119
- config[:author] = @author
120
- config[:date] = @date
121
-
122
- file_handler = ModuleHandler.new([] ,[] ,config)
123
-
124
- file_handler.yk_module_folders
125
- file_handler.yk_template_files
126
-
127
- end
110
+ config[:final_path] = final_path
111
+ config[:name] = @name
112
+ config[:project] = @project
113
+ config[:prefixed_module] = @prefixed_module
114
+ config[:author] = @author
115
+ config[:date] = @date
116
+
117
+ if !is_simple== true
118
+ file_handler = ModuleHandler.new([], [], config)
119
+ file_handler.yk_module_folders
120
+ file_handler.yk_template_files
121
+ end
122
+ Dir.chdir("#{final_path}/Example") do
123
+ system 'pod install'
124
+ system "open './#{@name}.xcworkspace'"
125
+ end
126
+ end
128
127
 
129
128
  #
130
129
  #
@@ -137,29 +136,25 @@ module YkCommand
137
136
  #
138
137
  # else
139
138
 
140
-
141
-
142
-
143
- # say '模块名:', :green
144
- # input_name = ask("Project name [#{config[:project]}] ?")
145
- # if input_name != ''
146
- # config[:project] = input_name if input_name != config[:project]
147
- # else
148
- # say '请正确填写模块名',:red
149
- # end
150
- #
151
- # say '语言:', :green
152
- # language = ask("Project language [#{config[:language]}] ?", limited_to: ['objc', 'swift', ''])
153
- # say '类名前缀:', :green
154
- # class_prefix = ask("Class prefix [#{config[:class_prefix]}] ?")
155
- # say '文件作者:', :green
156
- # author = ask("Author [#{config[:author]}] ?")
157
- #
158
- # config[:project] = project.empty? ? config[:project] || '' : project
159
- # config[:language] = language.empty? ? config[:language] || 'objc' : language
160
- # config[:class_prefix] = class_prefix.empty? ? config[:class_prefix] || '' : class_prefix
161
- # config[:author] = author.empty? ? config[:author] || '' : author
162
-
139
+ # say '模块名:', :green
140
+ # input_name = ask("Project name [#{config[:project]}] ?")
141
+ # if input_name != ''
142
+ # config[:project] = input_name if input_name != config[:project]
143
+ # else
144
+ # say '请正确填写模块名',:red
145
+ # end
146
+ #
147
+ # say '语言:', :green
148
+ # language = ask("Project language [#{config[:language]}] ?", limited_to: ['objc', 'swift', ''])
149
+ # say '类名前缀:', :green
150
+ # class_prefix = ask("Class prefix [#{config[:class_prefix]}] ?")
151
+ # say '文件作者:', :green
152
+ # author = ask("Author [#{config[:author]}] ?")
153
+ #
154
+ # config[:project] = project.empty? ? config[:project] || '' : project
155
+ # config[:language] = language.empty? ? config[:language] || 'objc' : language
156
+ # config[:class_prefix] = class_prefix.empty? ? config[:class_prefix] || '' : class_prefix
157
+ # config[:author] = author.empty? ? config[:author] || '' : author
163
158
 
164
159
  # end
165
160
 
@@ -204,17 +199,16 @@ module YkCommand
204
199
 
205
200
  # def prepare_folder
206
201
 
207
- # host_a = 'yeah'
208
- # host_b = 'ka'
209
- # template_repo_url = "http://gitlab.#{host_a}#{host_b}.com/App/iOS/YKComponents/YKProjectTemplate.git"
210
- # system("git clone #{template_repo_url} #{@final_path}")
202
+ # host_a = 'yeah'
203
+ # host_b = 'ka'
204
+ # template_repo_url = "http://gitlab.#{host_a}#{host_b}.com/App/iOS/YKComponents/YKProjectTemplate.git"
205
+ # system("git clone #{template_repo_url} #{@final_path}")
211
206
 
212
- # FileUtils.remove_dir(@final_path, true)
213
- # FileUtils.cp_r('/Users/imacn24/Documents/dev/YKProjectTemplate', @final_path)
214
- # FileUtils.remove_dir("#{@final_path}/.git", true)
207
+ # FileUtils.remove_dir(@final_path, true)
208
+ # FileUtils.cp_r('/Users/imacn24/Documents/dev/YKProjectTemplate', @final_path)
209
+ # FileUtils.remove_dir("#{@final_path}/.git", true)
215
210
  # end
216
211
 
217
-
218
212
  end
219
213
  end
220
214
  end