lhj-tools 0.1.96 → 0.1.97

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: aa4d693bb22ce7c5059df391d0596da915785429d480109afc53674710885976
4
- data.tar.gz: b431fe5461e189eccc44bae77472c1cbad6bd0f4576675389b8ffba699612782
3
+ metadata.gz: 3141a25ce2e0c2b88124dd148417f856317982f1f4da81b9bd43c90ee858b820
4
+ data.tar.gz: 70f7ffc027cbcb03cb1c4b613a2e132cd46e57dbd2833d36ff88aacc395ed636
5
5
  SHA512:
6
- metadata.gz: 1118b0ca825f9d8c6dd47a09f26bfab28a2b486e4ecf30893d685de5e21470e00bae8523dfe6c7b8aa8b8ede3a3b8c98fedd028ed4c7e2d60dbdda9f2f090a3b
7
- data.tar.gz: 05471f260b844ae9851ebae6dc7763972182000065be1ac0a1c0b65637b1df6c1b8a27f7e425292bbf3b3a07d663128d63f673397671ea39e265d9eea5c5159b
6
+ metadata.gz: ab33b726b8306c881f3ecbced49a801d1d217cb7a340d88b759e82a4d283f2c18f0db89584296edb8e00ca9abb3c8d212ea82d1ee3cf423b56637b507fa9ba14
7
+ data.tar.gz: b172f1fbe29b4475b777a30dd646d0e01bf83015406cfeb22a161010edb2f62a299cee0db36a7a3a2ee9e4ab40b3583f2a5317da749ef0d1b96bc826b837ff4b
@@ -148,10 +148,10 @@ module Lhj
148
148
  end
149
149
 
150
150
  def push_to_git
151
- Actions.sh('git checkout master')
152
- Actions.sh('git add .')
153
- Actions.sh("git commit -m 'generate yapi code'")
154
- Actions.sh('git push')
151
+ Actions.sh('git checkout master', log: false)
152
+ Actions.sh('git add .', log: false)
153
+ Actions.sh("git commit -m 'generate yapi code'", log: false)
154
+ Actions.sh('git push', log: false)
155
155
  end
156
156
 
157
157
  def notify_robot(upload_info, interface_info, project_info)
@@ -169,7 +169,10 @@ module Lhj
169
169
  })
170
170
  template = Lhj::ErbTemplateHelper.load('oc_code_notify')
171
171
  output = Lhj::ErbTemplateHelper.render(template, temp_vars, '-')
172
- Lhj::Dingtalk.post_message_robot(robot_url, 'yapi generate', output)
172
+ btn_array = [
173
+ { 'title' => '查看Yapi', 'actionURL' => api_url }
174
+ ]
175
+ Lhj::Dingtalk.post_card_message_robot(robot_url, 'yapi generate', output, btn_array)
173
176
  end
174
177
 
175
178
  def interface_url_str
@@ -7,45 +7,39 @@ module Lhj
7
7
 
8
8
  def self.post_message(title, message)
9
9
  robot_url = Lhj::DingTalkConfig.dingtalk_robot
10
- http_body = http_body_message(title, message)
10
+ post_message_robot(robot_url, title, message)
11
+ end
12
+
13
+ def self.post_message_robot(robot_url, title, message)
14
+ http_body = markdown_body_message(title, message)
11
15
  http_post(robot_url, http_body)
12
- post_branch_message(http_body)
13
16
  end
14
17
 
15
18
  def self.post_card_message(title, message, btns)
16
19
  robot_url = Lhj::DingTalkConfig.dingtalk_robot
20
+ post_card_message_robot(robot_url, title, message, btns)
21
+ end
22
+
23
+ def self.post_card_message_robot(robot_url, title, message, btns)
17
24
  http_body = action_card_body_message(title, message, btns, :vertical)
18
25
  http_post(robot_url, http_body)
19
26
  end
20
27
 
21
28
  def self.post_single_card_message(title, message, single_title, single_url)
22
29
  robot_url = Lhj::DingTalkConfig.dingtalk_robot
23
- http_body = single_action_card_body_message(title, message, single_title, single_url)
24
- http_post(robot_url, http_body)
30
+ post_single_card_message_robot(robot_url, title, message, single_title, single_url)
25
31
  end
26
32
 
27
- def self.post_branch_message(http_body)
28
- branch_name = fetch_branch
29
- branch_map = Lhj::DingTalkConfig.git_branch
30
- branch_robot_key = branch_map[branch_name] if branch_map && branch_name
31
- branch_robot_url = Lhj::DingTalkConfig.config[branch_robot_key] if branch_robot_key
32
- http_post(branch_robot_url, http_body) if branch_robot_url
33
+ def self.post_single_card_message_robot(robot_url, title, message, single_title, single_url)
34
+ http_body = single_action_card_body_message(title, message, single_title, single_url)
35
+ http_post(robot_url, http_body)
33
36
  end
34
37
 
35
38
  def self.http_post(robot_url, http_body)
36
39
  Net::HTTP.post(URI(robot_url), http_body, 'Content-Type' => 'application/json')
37
40
  end
38
41
 
39
- def self.post_message_robot(robot_url, title, message)
40
- http_body = http_body_message(title, message)
41
- Net::HTTP.post(URI(robot_url), http_body, 'Content-Type' => 'application/json')
42
- end
43
-
44
- def self.post_action_card_message_robot(robot_url, title, message, btns)
45
- http_body = action_card_body_message(title, message, btns, :vertical)
46
- Net::HTTP.post(URI(robot_url), http_body, 'Content-Type' => 'application/json')
47
- end
48
-
42
+ # deprecation warnings used: markdown_body_message method
49
43
  def self.http_body_message(title, message)
50
44
  markdown_body_message(title, message)
51
45
  end
@@ -87,10 +81,5 @@ module Lhj
87
81
  'feedCard' => links
88
82
  }.to_json
89
83
  end
90
-
91
- def self.fetch_branch
92
- name = Lhj::Actions.git_branch || ''
93
- name.split('/').last
94
- end
95
84
  end
96
85
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lhj
4
4
  module Tools
5
- VERSION = "0.1.96"
5
+ VERSION = "0.1.97"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lhj-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.96
4
+ version: 0.1.97
5
5
  platform: ruby
6
6
  authors:
7
7
  - lihaijian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-14 00:00:00.000000000 Z
11
+ date: 2023-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xcodeproj