yk_command 0.4.9 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84101a181b3367982abaa93551c5a266b5b5378fa0d7ddee276883f558131c0f
4
- data.tar.gz: 3d7437d3f691417da408a82706e0d296a61e992faaacd9f38f3f4f0e1b77faf7
3
+ metadata.gz: 0270360ed964ef12d21ff5a0d2687a78243877286d62e503fc3d9ac4b5378440
4
+ data.tar.gz: e34b5d101303ed14d2e1094ba4c2f3ecb49874b38fcd02334738659578bc3f52
5
5
  SHA512:
6
- metadata.gz: 4281ae85ed46d7fcc4b1db00324d8617e4b41db64b96bcece74e2ed7b60c9650dedb1a767584a6b9ed5e2f4eefb1a0122b489d4d62cf5e671c189a4ca96ce91a
7
- data.tar.gz: 2a05f6a12a61bf402728ac83124c4d6cc8e2dc43560d9c7b130edeabf3ff85d4fe9320931e8a20a49be36e51891e799ca34832231aef7be0bbc2405a9a582d64
6
+ metadata.gz: 94df888ee6a59310135cc4f7a04e7c68c42daf597ba3c2ef52bd1ea4e7fea81d1d5e5aed1bae7f627991e57b401ae76ca25a507998858adf3f53c0fc44e77fd0
7
+ data.tar.gz: 3a5f3a628a8c726affc50d657b72da0a6b7f46b6b8826349493f0a5f90f822641071814723f8479d48cf2e58ace4d93be5ac376901371f83bee9dc6df997d044
File without changes
data/.idea/yk_command.iml CHANGED
@@ -41,7 +41,7 @@
41
41
  <orderEntry type="library" scope="PROVIDED" name="httparty (v0.20.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
42
42
  <orderEntry type="library" scope="PROVIDED" name="httpclient (v2.8.3, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
43
43
  <orderEntry type="library" scope="PROVIDED" name="i18n (v1.10.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
44
- <orderEntry type="library" scope="PROVIDED" name="json (v2.6.1, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
44
+ <orderEntry type="library" scope="PROVIDED" name="json (v2.6.2, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
45
45
  <orderEntry type="library" scope="PROVIDED" name="mime-types (v3.4.1, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
46
46
  <orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2022.0105, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
47
47
  <orderEntry type="library" scope="PROVIDED" name="minitest (v5.15.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
@@ -72,6 +72,7 @@
72
72
  <orderEntry type="library" scope="PROVIDED" name="typhoeus (v1.4.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
73
73
  <orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.4, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
74
74
  <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.1.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
75
+ <orderEntry type="library" scope="PROVIDED" name="wechat_work_webhook (v0.1.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
75
76
  <orderEntry type="library" scope="PROVIDED" name="xcodeproj (v1.21.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
76
77
  <orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.5.4, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
77
78
  </component>
@@ -79,21 +80,21 @@
79
80
  <option name="myRootTask">
80
81
  <RakeTaskImpl id="rake">
81
82
  <subtasks>
82
- <RakeTaskImpl description="Build yk_command-0.4.8.gem into the pkg directory" fullCommand="build" id="build" />
83
+ <RakeTaskImpl description="Build yk_command-0.4.9.gem into the pkg directory" fullCommand="build" id="build" />
83
84
  <RakeTaskImpl id="build">
84
85
  <subtasks>
85
- <RakeTaskImpl description="Generate SHA512 checksum if yk_command-0.4.8.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
86
+ <RakeTaskImpl description="Generate SHA512 checksum if yk_command-0.4.9.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
86
87
  </subtasks>
87
88
  </RakeTaskImpl>
88
89
  <RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
89
90
  <RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
90
- <RakeTaskImpl description="Build and install yk_command-0.4.8.gem into system gems" fullCommand="install" id="install" />
91
+ <RakeTaskImpl description="Build and install yk_command-0.4.9.gem into system gems" fullCommand="install" id="install" />
91
92
  <RakeTaskImpl id="install">
92
93
  <subtasks>
93
- <RakeTaskImpl description="Build and install yk_command-0.4.8.gem into system gems without network access" fullCommand="install:local" id="local" />
94
+ <RakeTaskImpl description="Build and install yk_command-0.4.9.gem into system gems without network access" fullCommand="install:local" id="local" />
94
95
  </subtasks>
95
96
  </RakeTaskImpl>
96
- <RakeTaskImpl description="Create tag v0.4.8 and build and push yk_command-0.4.8.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
97
+ <RakeTaskImpl description="Create tag v0.4.9 and build and push yk_command-0.4.9.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
97
98
  <RakeTaskImpl description="" fullCommand="default" id="default" />
98
99
  <RakeTaskImpl description="" fullCommand="release" id="release" />
99
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.4.9)
4
+ yk_command (0.5.0)
5
5
  bundler
6
6
  cocoapods
7
7
  cocoapods-core
@@ -11,6 +11,7 @@ PATH
11
11
  httparty
12
12
  pathname (= 0.1.0)
13
13
  thor
14
+ wechat_work_webhook
14
15
  xcodeproj
15
16
 
16
17
  GEM
@@ -140,6 +141,8 @@ GEM
140
141
  tzinfo (2.0.4)
141
142
  concurrent-ruby (~> 1.0)
142
143
  unicode-display_width (2.1.0)
144
+ wechat_work_webhook (0.1.0)
145
+ httparty
143
146
  xcodeproj (1.21.0)
144
147
  CFPropertyList (>= 2.3.3, < 4.0)
145
148
  atomos (~> 0.1.3)
@@ -9,9 +9,10 @@ require 'yaml'
9
9
  require 'git'
10
10
  require 'yk_command/analyze/dependency_result'
11
11
 
12
+ require 'yk_command/bot/wx_bot'
12
13
  module YkCommand
13
14
  IGNORE_PROJECT_FILE = '.YKAnalyzeConfig.yml'.freeze
14
-
15
+ BOT_CONFIG_FILE = '.YKBotConfig.yml'.freeze
15
16
  class Analyzer < Thor
16
17
  no_commands do
17
18
 
@@ -105,6 +106,14 @@ module YkCommand
105
106
  say "failed :#{failed_count},#{failed_name_list}", :red
106
107
  say "skip :#{skip_count}", :yellow
107
108
 
109
+ bot_config_file_path = "#{path}/#{BOT_CONFIG_FILE}"
110
+ bot_config = File.exist?(bot_config_file_path) ? YAML.load_file(bot_config_file_path) : nil
111
+ if bot_config
112
+ bot = WxBot.new(bot_config)
113
+ bot.send_result_to_group(success_name_list,failed_name_list)
114
+ bot.send_news_to_group
115
+ end
116
+
108
117
  end
109
118
 
110
119
  def ignore_file(path = nil)
@@ -19,5 +19,6 @@ module YkCommand
19
19
  self.class.get('/project/projectByName', query: { "name" => app_project_name } )
20
20
  end
21
21
 
22
+
22
23
  end
23
24
  end
@@ -0,0 +1,75 @@
1
+ require 'cocoapods'
2
+ require 'pathname'
3
+ require 'pp'
4
+ require 'tmpdir'
5
+ require 'json'
6
+
7
+ require 'rainbow'
8
+ require 'yaml'
9
+ require 'git'
10
+ require 'yk_command/analyze/dependency_result'
11
+ require 'wechat_work_webhook'
12
+ module YkCommand
13
+ class WxBot < Thor
14
+
15
+
16
+
17
+ no_commands do
18
+
19
+ def initialize(config)
20
+
21
+ webhook_url = config[:webhook_url]
22
+ @project_url = config[:project_url]
23
+ @project_cover_image_url = config[:project_cover_image_url]
24
+
25
+ @wechat = WechatWorkWebhook.new(webhook_url)
26
+ end
27
+
28
+ def send_result_to_group(success_list, failed_list)
29
+ time = Time.new
30
+ time_s = "#{time.year}-#{time.month}-#{time.day} "
31
+ @wechat.markdown("## #{time_s} 分析结果\n### 成功 #{success_list.length} 个 #{result_item_list_string(success_list, 'success')}\n### 失败 #{failed_list.length} 个 #{result_item_list_string(failed_list, 'failed')}")
32
+
33
+ end
34
+
35
+ def send_news_to_group
36
+ require 'wechat_work_webhook'
37
+
38
+ # wechat.text('test', ['@all'])
39
+ #
40
+
41
+ # <font color=\"DodgerBlue\"></font>
42
+ time = Time.new
43
+ time_s = "#{time.year}-#{time.month}-#{time.day} "
44
+
45
+ @wechat.news([{
46
+ "title" => "#{time_s} 依赖分析已完成",
47
+ "description" => "点击进入组件管理平台",
48
+ "url" => @project_url,
49
+ "picurl" => @project_cover_image_url
50
+ }])
51
+
52
+ # wechat.image('test.png')
53
+ #
54
+ # wechat.media(wechat.upload_media('test.csv')['media_id'])
55
+ #
56
+ # wechat.file('test.csv')
57
+
58
+ end
59
+
60
+ def result_item_list_string(list, level)
61
+ result = ''
62
+ list.each do |name|
63
+ if level == 'success'
64
+ result += "\n- <font color=\"#0099ff\">#{name}</font> "
65
+ else
66
+ result += "\n- <font color=\"#DC143C\">#{name}</font> "
67
+ end
68
+ end
69
+ result
70
+ end
71
+ end
72
+
73
+ end
74
+
75
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module YkCommand
4
- VERSION = '0.4.9'.freeze
4
+ VERSION = '0.5.0'.freeze
5
5
  end
data/yk_command.gemspec CHANGED
@@ -46,6 +46,7 @@ Gem::Specification.new do |spec|
46
46
  spec.add_dependency 'colored2'
47
47
  spec.add_dependency 'pathname','0.1.0'
48
48
  spec.add_dependency 'httparty'
49
+ spec.add_dependency 'wechat_work_webhook'
49
50
  # For more information and examples about making a new gem, checkout our
50
51
  # guide at: https://bundler.io/guides/creating_gem.html
51
52
  end
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.4.9
4
+ version: 0.5.0
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-05-30 00:00:00.000000000 Z
11
+ date: 2022-06-02 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: wechat_work_webhook
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
  description: a longer description or delete this line.
196
210
  email:
197
211
  - v2top1@163.com
@@ -206,6 +220,7 @@ files:
206
220
  - ".idea/.gitignore"
207
221
  - ".idea/misc.xml"
208
222
  - ".idea/modules.xml"
223
+ - ".idea/sonarlint/issuestore/index.pb"
209
224
  - ".idea/vcs.xml"
210
225
  - ".idea/yk_command.iml"
211
226
  - Gemfile
@@ -223,6 +238,7 @@ files:
223
238
  - lib/yk_command/analyze/analyze.rb
224
239
  - lib/yk_command/analyze/dependency_result.rb
225
240
  - lib/yk_command/analyze/request.rb
241
+ - lib/yk_command/bot/wx_bot.rb
226
242
  - lib/yk_command/commands.rb
227
243
  - lib/yk_command/module/template/objc/CategoryHeader.h
228
244
  - lib/yk_command/module/template/objc/PrefixHeader.pch