yk_command 0.5.1 → 0.5.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee7ba207bd464c7157f889962cca513322a4763d409fdc706caf2d8ce49d21e0
4
- data.tar.gz: c94c6c49d162b732fd9ef39d6e4cee3d23899dcb9eac8c3a884a0ce07ad675e9
3
+ metadata.gz: 7a86ae389cad94055cc7b1078c498cf184bb4a3c316c29d75743c63c11f082c5
4
+ data.tar.gz: 81b2ab46a6e03c45c210ae45b4e261d798779805aa8edccc8388ce240d6916d6
5
5
  SHA512:
6
- metadata.gz: 415355f8510cd4e83bc60cf03bac2607e2c746d0793f0ec09bc54be45866fab5d3c4c9a786a9b1d731d32dfcd592d4f342ca79fcf931ce2c78a04df4e13c13f6
7
- data.tar.gz: 2d7073f479b8d58177b3ea9fda216544521fa914a80caeb4796527558949dac347ad87058274fe13fcc7b51d7ddd284d10fb0c200708ccf8f87bb25410f7dec6
6
+ metadata.gz: 1167e9722bfc122e95aad69fee90af9d6d9965680494d58d9dfa83945d008d5ce596c34430ef8ab69d358fb7a4487d4336743f27ed8f4c02310a84f045d52251
7
+ data.tar.gz: be9d9504b13ba9f850ee2eabd493b4bf00492dd546df93ac9cc38ceb53d6d306f55a1c050094e28d34e1286b2b308b4ef86cc61c132b12930e064e9b477b5556
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yk_command (0.5.1)
4
+ yk_command (0.5.2)
5
5
  bundler
6
6
  cocoapods
7
7
  cocoapods-core
@@ -9,6 +9,7 @@ PATH
9
9
  colored2
10
10
  git
11
11
  httparty
12
+ rainbow
12
13
  rubyzip
13
14
  thor
14
15
  wechat_work_webhook
@@ -10,6 +10,8 @@ require 'git'
10
10
  require 'yk_command/analyze/dependency_result'
11
11
 
12
12
  require 'yk_command/bot/wx_bot'
13
+ require 'yk_command/config/yk_config'
14
+
13
15
  module YkCommand
14
16
  IGNORE_PROJECT_FILE = '.YKAnalyzeConfig.yml'.freeze
15
17
  BOT_CONFIG_FILE = '.YKBotConfig.yml'.freeze
@@ -106,12 +108,16 @@ module YkCommand
106
108
  say "failed :#{failed_count},#{failed_name_list}", :red
107
109
  say "skip :#{skip_count}", :yellow
108
110
 
109
- # bot_message path
111
+ bot_message path ,success_name_list,failed_name_list
112
+
110
113
  end
111
114
 
112
- def bot_message(path)
113
- bot_config_file_path = "#{path}/#{BOT_CONFIG_FILE}"
114
- bot_config = File.exist?(bot_config_file_path) ? YAML.load_file(bot_config_file_path) : nil
115
+ def bot_message(path,success_name_list,failed_name_list)
116
+
117
+ # bot_config_file_path = "#{path}/#{BOT_CONFIG_FILE}"
118
+ # bot_config = File.exist?(bot_config_file_path) ? YAML.load_file(bot_config_file_path) : nil
119
+
120
+ bot_config = YkConfig.new.read_config path , BOT_CONFIG_FILE
115
121
  if bot_config
116
122
  bot = WxBot.new(bot_config)
117
123
  bot.send_result_to_group(success_name_list,failed_name_list)
@@ -2,10 +2,10 @@ require 'httparty'
2
2
  module YkCommand
3
3
  class Request
4
4
  include HTTParty
5
- # base_uri 'http://127.0.0.1:9988/'
5
+ base_uri 'http://127.0.0.1:9988/'
6
6
 
7
7
  # base_uri 'http://10.30.106.143:9988/'
8
- base_uri 'http://10.30.80.113:9988'
8
+ # base_uri 'http://10.30.80.113:9988'
9
9
 
10
10
  headers 'Content-Type' => 'application/json'
11
11
 
@@ -19,6 +19,13 @@ module YkCommand
19
19
  self.class.get('/project/projectByName', query: { "name" => app_project_name } )
20
20
  end
21
21
 
22
+ def upload_app(app_list_data)
23
+ self.class.post('/project/updateAllAppProjects',body: {'data' => app_list_data}.to_json)
24
+ end
25
+
26
+ def upload_component(data)
27
+ self.class.post('/project/updateAllComponents',body: {'data' => data}.to_json)
28
+ end
22
29
 
23
30
  end
24
31
  end
@@ -9,6 +9,7 @@ require 'yaml'
9
9
  require 'git'
10
10
  require 'yk_command/analyze/dependency_result'
11
11
  require 'wechat_work_webhook'
12
+ require 'thor'
12
13
  module YkCommand
13
14
  class WxBot < Thor
14
15
 
@@ -4,6 +4,8 @@ require 'yk_command/analyze/analyze'
4
4
  require 'yk_command/analyze/request'
5
5
  require 'yk_command/module/yk_module'
6
6
 
7
+ require_relative 'component_manage/component_manage_platform'
8
+
7
9
  module YkCommand
8
10
 
9
11
  class CLI < Thor
@@ -38,5 +40,17 @@ module YkCommand
38
40
  Analyzer.new.workspace_analyze path
39
41
  end
40
42
 
43
+
44
+ desc 'platform_refresh ', '更新平台的app和组件数据'
45
+ method_option :platform_refresh, aliases: '-pr'
46
+
47
+ def platform_refresh
48
+ p = ComponentManagePlatform.new
49
+ p.update_app_data
50
+ p.update_component_data
51
+
52
+ end
53
+
54
+
41
55
  end
42
56
  end
@@ -0,0 +1,29 @@
1
+
2
+
3
+ require 'yk_command/gitlab/yk_gitlab'
4
+ require 'yk_command/analyze/request'
5
+
6
+ module YkCommand
7
+
8
+ class ComponentManagePlatform < Thor
9
+ include Thor::Actions
10
+ no_commands do
11
+ def update_app_data
12
+ data = YkGitlab.new.get_all_app
13
+ list = data.parsed_response['shared_projects']
14
+
15
+ r = Request.new.upload_app(list)
16
+ pp r
17
+ end
18
+
19
+ def update_component_data
20
+ data = YkGitlab.new.get_all_components
21
+ list = data.parsed_response['projects']
22
+ r = Request.new.upload_component(list)
23
+ pp r
24
+ end
25
+ end
26
+
27
+ end
28
+
29
+ end
@@ -0,0 +1,25 @@
1
+
2
+ module YkCommand
3
+
4
+ class YkConfig < Thor
5
+
6
+
7
+
8
+ include Thor::Actions
9
+ no_commands do
10
+ def read_config(at_path,file_name)
11
+ hostA = 'yeah'
12
+ hostB = 'ka'
13
+ config_repo_url = "http://gitlab.#{hostA}#{hostB}.com/App/iOS/YKComponents/com-manage-platform-resources/configruation-files.git"
14
+ system("git clone #{config_repo_url} #{at_path+'/configruation-files'}")
15
+
16
+ config_file_path = "#{at_path}/#{file_name}"
17
+ FileUtils.copy_file "#{at_path+'/configruation-files/'+file_name}", config_file_path
18
+ FileUtils.remove_dir("#{at_path+'/configruation-files'}", true)
19
+
20
+ File.exist?(config_file_path) ? YAML.load_file(config_file_path) : {}
21
+ end
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,46 @@
1
+
2
+ require 'httparty'
3
+
4
+ module YkCommand
5
+ GITLAB_TOKEN = 'oPvxMkmDhVjhhzixBAiJ'
6
+
7
+ class YkGitlab
8
+
9
+ include HTTParty
10
+
11
+
12
+ # http://gitlab.yeahka.com/api/v3/groups/917?private_token=oPvxMkmDhVjhhzixBAiJ
13
+
14
+ base_uri 'http://gitlab.yeahka.com/api/v3'
15
+
16
+
17
+
18
+ headers 'Content-Type' => 'application/json'
19
+
20
+
21
+
22
+
23
+ def get_all_app
24
+
25
+ get_group_projects 917,100,0
26
+
27
+ end
28
+
29
+ def get_all_components
30
+
31
+ get_group_projects 514,100,0
32
+
33
+ end
34
+
35
+
36
+
37
+ def get_group_projects(group_id,per_page,page)
38
+ self.class.get("/groups/#{group_id}", query: { "private_token" => GITLAB_TOKEN,"per_page"=> per_page,"page"=> page })
39
+ end
40
+
41
+ end
42
+
43
+
44
+
45
+
46
+ end
@@ -3,11 +3,11 @@ require 'fileutils'
3
3
  require 'psych'
4
4
  require 'thor/actions'
5
5
  require_relative 'setup/TemplateConfigurator'
6
+ require 'yk_command/config/yk_config'
6
7
 
7
8
  require 'pathname'
8
9
 
9
10
  module YkCommand
10
-
11
11
  PROJECT_CONFIG_FILE = '.YKProjectConfig.yml'.freeze
12
12
 
13
13
  class YkProject < Thor
@@ -29,7 +29,7 @@ module YkCommand
29
29
 
30
30
  FileUtils.copy_entry "#{current_class_path.to_s + '/YKProjectTemplate'}", "#{current_class_path.to_s + '/temp'}"
31
31
 
32
- prepare_template(read_config(at_path))
32
+ prepare_template(YkConfig.new.read_config at_path,PROJECT_CONFIG_FILE)
33
33
 
34
34
  Pod::TemplateConfigurator.new(pod_name, framework, prefix, author, "#{current_class_path.to_s + '/temp'}").run
35
35
  #move temp folder to destination
@@ -67,18 +67,18 @@ module YkCommand
67
67
  end
68
68
  end
69
69
 
70
- def read_config(at_path)
71
- hostA = 'yeah'
72
- hostB = 'ka'
73
- config_repo_url = "http://gitlab.#{hostA}#{hostB}.com/App/iOS/YKComponents/com-manage-platform-resources/configruation-files.git"
74
- system("git clone #{config_repo_url} #{at_path+'/configruation-files'}")
75
-
76
- config_file_path = "#{at_path}/#{PROJECT_CONFIG_FILE}"
77
- FileUtils.copy_file "#{at_path+'/configruation-files/'+PROJECT_CONFIG_FILE}", config_file_path
78
- FileUtils.remove_dir("#{at_path+'/configruation-files'}", true)
79
-
80
- File.exist?(config_file_path) ? YAML.load_file(config_file_path) : {}
81
- end
70
+ # def read_config(at_path)
71
+ # hostA = 'yeah'
72
+ # hostB = 'ka'
73
+ # config_repo_url = "http://gitlab.#{hostA}#{hostB}.com/App/iOS/YKComponents/com-manage-platform-resources/configruation-files.git"
74
+ # system("git clone #{config_repo_url} #{at_path+'/configruation-files'}")
75
+ #
76
+ # config_file_path = "#{at_path}/#{PROJECT_CONFIG_FILE}"
77
+ # FileUtils.copy_file "#{at_path+'/configruation-files/'+PROJECT_CONFIG_FILE}", config_file_path
78
+ # FileUtils.remove_dir("#{at_path+'/configruation-files'}", true)
79
+ #
80
+ # File.exist?(config_file_path) ? YAML.load_file(config_file_path) : {}
81
+ # end
82
82
 
83
83
  end
84
84
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module YkCommand
4
- VERSION = '0.5.1'.freeze
4
+ VERSION = '0.5.2'.freeze
5
5
  end
data/yk_command.gemspec CHANGED
@@ -46,7 +46,7 @@ Gem::Specification.new do |spec|
46
46
  spec.add_dependency 'colored2'
47
47
  spec.add_dependency 'httparty'
48
48
  spec.add_dependency 'wechat_work_webhook'
49
-
49
+ spec.add_dependency 'rainbow'
50
50
  spec.add_dependency 'rubyzip'
51
51
  # For more information and examples about making a new gem, checkout our
52
52
  # guide at: https://bundler.io/guides/creating_gem.html
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yk_command
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Major Tom
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-16 00:00:00.000000000 Z
11
+ date: 2022-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -192,6 +192,20 @@ dependencies:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: rainbow
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
195
209
  - !ruby/object:Gem::Dependency
196
210
  name: rubyzip
197
211
  requirement: !ruby/object:Gem::Requirement
@@ -239,6 +253,9 @@ files:
239
253
  - lib/yk_command/analyze/request.rb
240
254
  - lib/yk_command/bot/wx_bot.rb
241
255
  - lib/yk_command/commands.rb
256
+ - lib/yk_command/component_manage/component_manage_platform.rb
257
+ - lib/yk_command/config/yk_config.rb
258
+ - lib/yk_command/gitlab/yk_gitlab.rb
242
259
  - lib/yk_command/module/module_handler.rb
243
260
  - lib/yk_command/module/template/objc/CategoryHeader.h
244
261
  - lib/yk_command/module/template/objc/PrefixHeader.pch