lhj-tools 0.2.23 → 0.2.24
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/lib/lhj/command/jenkins/jenkins_build.rb +21 -2
- data/lib/lhj/helper/apple/{token.rb → apple_connect_api.rb} +15 -0
- data/lib/lhj/helper/bugly_helper.rb +1 -0
- data/lib/lhj/helper/chat_gpt_config.rb +28 -0
- data/lib/lhj/helper/ios_robot_config.rb +39 -0
- data/lib/lhj/lhj.rb +3 -0
- data/lib/lhj/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 253e532b62ca8fd6c1b10281d9dfc87cb2f1a40abbd185f66066abc72b7cd72d
|
4
|
+
data.tar.gz: 3b67e5cfb736805d1b078b72efe4cab2d8f28848c77e8b3d049fbf6dfc227648
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f23ae53bdd2047b055f1baec787b67a21684b42f23f1004c503ebcfc157670fd6d09c58f774a7a3fad374371ae474b534cc616835da73ea53595a40047fa321f
|
7
|
+
data.tar.gz: 7ddab83f382970b112d558ec7b410def3530281cc321dc3f77af73d5c342ade9f600779870e9ced7bfe78c6d3c6c15c58d205e4b1ef3a5f0c34f2f013258f5f3
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'jenkins_api_client'
|
2
|
-
require 'lhj/helper/apple/token'
|
3
2
|
|
4
3
|
module Lhj
|
5
4
|
class Command
|
@@ -31,7 +30,27 @@ module Lhj
|
|
31
30
|
end
|
32
31
|
|
33
32
|
def handle
|
34
|
-
|
33
|
+
d = {
|
34
|
+
"data": {
|
35
|
+
"attributes": {
|
36
|
+
"email": "878943972@qq.com",
|
37
|
+
"firstName": "li",
|
38
|
+
"lastName": "haijian"
|
39
|
+
},
|
40
|
+
"relationships": {
|
41
|
+
"builds": {
|
42
|
+
"data": [
|
43
|
+
{
|
44
|
+
"id": "0cd7ac82-b2d9-4772-bfa1-0ff6e8037f7d",
|
45
|
+
"type": "builds"
|
46
|
+
}
|
47
|
+
]
|
48
|
+
}
|
49
|
+
},
|
50
|
+
"type": "betaTesters"
|
51
|
+
}
|
52
|
+
}
|
53
|
+
res = Lhj::ConnectAPI.post('https://api.appstoreconnect.apple.com/v1/betaTesters', d)
|
35
54
|
puts res.read_body
|
36
55
|
|
37
56
|
# client = JenkinsApi::Client.new(server_ip: 'ip', server_port: 0, username: 'xx', password: 'xx')
|
@@ -29,5 +29,20 @@ module Lhj
|
|
29
29
|
|
30
30
|
https.request(request)
|
31
31
|
end
|
32
|
+
|
33
|
+
def self.post(url, data = {})
|
34
|
+
uri = URI(url)
|
35
|
+
|
36
|
+
https = Net::HTTP.new(uri.host, uri.port)
|
37
|
+
https.use_ssl = true
|
38
|
+
|
39
|
+
request = Net::HTTP::Post.new(uri)
|
40
|
+
jwt_token = token
|
41
|
+
request['authorization'] = "Bearer #{jwt_token}"
|
42
|
+
request['Content-Type'] = 'application/json'
|
43
|
+
request.body = JSON.dump(data)
|
44
|
+
|
45
|
+
https.request(request)
|
46
|
+
end
|
32
47
|
end
|
33
48
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
module Lhj
|
5
|
+
# chat gpt Config
|
6
|
+
class ChatGptConfig
|
7
|
+
|
8
|
+
CONFIG_NAME = 'chat_gpt_config.yml'
|
9
|
+
|
10
|
+
def self.config_file
|
11
|
+
File.join(Lhj::Config.instance.home_dir, CONFIG_NAME)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.config
|
15
|
+
@yaml ||= YAML.load_file(config_file)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.api_key(idx)
|
19
|
+
i = idx % config.length
|
20
|
+
config[i]['api_key']
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.org_id(idx)
|
24
|
+
i = idx % config.length
|
25
|
+
config[i]['org_id']
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
module Lhj
|
5
|
+
# ios Robot Config
|
6
|
+
class IOSRobotConfig
|
7
|
+
|
8
|
+
CONFIG_NAME = 'robot_notify_config.yml'
|
9
|
+
|
10
|
+
def self.config_file
|
11
|
+
File.join(Lhj::Config.instance.home_dir, CONFIG_NAME)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.config
|
15
|
+
@yaml ||= YAML.load_file(config_file)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.fetch_robot_url(conversation)
|
19
|
+
url = config[0]['robot_url']
|
20
|
+
robot = config.find { |r| r['conversation_title'].eql?(conversation) } if conversation
|
21
|
+
url = robot['robot_url'] if robot && robot['robot_url']
|
22
|
+
url
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.fetch_robot_title(conversation)
|
26
|
+
title = '信息来自iOS机器人'
|
27
|
+
robot = config.find { |r| r['conversation_title'].eql?(conversation) } if conversation
|
28
|
+
title = robot['message_title'] if robot && robot['message_title']
|
29
|
+
title
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.fetch_robot_message_type(conversation)
|
33
|
+
type = :markdown
|
34
|
+
robot = config.find { |r| r['conversation_title'].eql?(conversation) } if conversation
|
35
|
+
type = :text if robot && robot['message_type'] && robot['message_type'].eql?('text')
|
36
|
+
type
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/lhj/lhj.rb
CHANGED
@@ -9,6 +9,9 @@ module Lhj
|
|
9
9
|
require 'lhj/config'
|
10
10
|
require 'lhj/helper/jenkins_config'
|
11
11
|
require 'lhj/helper/apple/apple_jwt_config'
|
12
|
+
require 'lhj/helper/apple/apple_connect_api'
|
13
|
+
require 'lhj/helper/ios_robot_config'
|
14
|
+
require 'lhj/helper/chat_gpt_config'
|
12
15
|
require 'lhj/helper/pod_repo_config'
|
13
16
|
require 'lhj/helper/git_branch_feature_config'
|
14
17
|
require 'lhj/helper/erb_template_helper'
|
data/lib/lhj/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lhj-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lihaijian
|
@@ -381,14 +381,16 @@ files:
|
|
381
381
|
- lib/lhj/config.rb
|
382
382
|
- lib/lhj/env.rb
|
383
383
|
- lib/lhj/helper/app_version_info.rb
|
384
|
+
- lib/lhj/helper/apple/apple_connect_api.rb
|
384
385
|
- lib/lhj/helper/apple/apple_jwt_config.rb
|
385
|
-
- lib/lhj/helper/apple/token.rb
|
386
386
|
- lib/lhj/helper/bugly_helper.rb
|
387
|
+
- lib/lhj/helper/chat_gpt_config.rb
|
387
388
|
- lib/lhj/helper/dingtalk_config.rb
|
388
389
|
- lib/lhj/helper/dingtalk_helper.rb
|
389
390
|
- lib/lhj/helper/erb_template_helper.rb
|
390
391
|
- lib/lhj/helper/git_branch_feature_config.rb
|
391
392
|
- lib/lhj/helper/git_helper.rb
|
393
|
+
- lib/lhj/helper/ios_robot_config.rb
|
392
394
|
- lib/lhj/helper/jenkins_config.rb
|
393
395
|
- lib/lhj/helper/local_config.rb
|
394
396
|
- lib/lhj/helper/log_helper.rb
|