lhj-tools 0.2.21 → 0.2.23
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 +6 -2
- data/lib/lhj/command/yapi.rb +1 -1
- data/lib/lhj/helper/apple/apple_jwt_config.rb +46 -0
- data/lib/lhj/helper/apple/token.rb +33 -0
- data/lib/lhj/lhj.rb +1 -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: 913995d83466a643c887e8ffe02fa7789b36992f53db19188711f845ad81c1e0
|
4
|
+
data.tar.gz: e21d8840c06763330eac1878bc823cac0fb678826feaea7ff76ce2c662043c06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b8ea86ee8c5ffb0f40e9ee60f39d1ee73713420fa5e31462ab067c3fbc2fed1057dfaa446762bda09c379306a1095ee14abf9e06a46ed4fad6d59ba6d83ef96
|
7
|
+
data.tar.gz: 9d978201993f562cdda911ba7662ac19000f83a4b5af3e0f8e69484f6c9fec7026b4294a44a69f03e03105dfdc9d6cd7308ef691e684f4eb01eb73de2a94217d
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'jenkins_api_client'
|
2
|
+
require 'lhj/helper/apple/token'
|
2
3
|
|
3
4
|
module Lhj
|
4
5
|
class Command
|
@@ -30,11 +31,14 @@ module Lhj
|
|
30
31
|
end
|
31
32
|
|
32
33
|
def handle
|
33
|
-
|
34
|
+
res = Lhj::ConnectAPI.get('https://api.appstoreconnect.apple.com/v1/apps')
|
35
|
+
puts res.read_body
|
36
|
+
|
37
|
+
# client = JenkinsApi::Client.new(server_ip: 'ip', server_port: 0, username: 'xx', password: 'xx')
|
34
38
|
# puts client.user.get('aomi')
|
35
39
|
# puts client.job.list_all
|
36
40
|
# client.job.build('aomi_uat')
|
37
|
-
puts client.job.get_console_output('aomi_uat', 253)
|
41
|
+
# puts client.job.get_console_output('aomi_uat', 253)
|
38
42
|
end
|
39
43
|
end
|
40
44
|
end
|
data/lib/lhj/command/yapi.rb
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
module Lhj
|
5
|
+
# Apple jwt Config
|
6
|
+
class AppleJWTConfig
|
7
|
+
|
8
|
+
CONFIG_NAME = 'apple_jwt_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.login_email
|
19
|
+
config['login_email']
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.login_password
|
23
|
+
config['login_password']
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.issuer_id
|
27
|
+
config['issuer_id']
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.key_id
|
31
|
+
config['key_id']
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.private_key
|
35
|
+
config['private_key']
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.private_key_url
|
39
|
+
config['private_key_url']
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.private_key_file
|
43
|
+
File.expand_path(File.join(Lhj::Config.instance.home_dir, "AuthKey_#{key_id}.p8"))
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'jwt'
|
2
|
+
require 'openssl'
|
3
|
+
|
4
|
+
module Lhj
|
5
|
+
class ConnectAPI
|
6
|
+
|
7
|
+
def self.token
|
8
|
+
key_file = File.binread(Lhj::AppleJWTConfig.private_key_file)
|
9
|
+
key = OpenSSL::PKey::EC.new(key_file)
|
10
|
+
expiration = Time.now + 500
|
11
|
+
header = { kid: Lhj::AppleJWTConfig.key_id }
|
12
|
+
payload = {
|
13
|
+
iss: Lhj::AppleJWTConfig.issuer_id,
|
14
|
+
exp: expiration.to_i,
|
15
|
+
aud: 'appstoreconnect-v1'
|
16
|
+
}
|
17
|
+
JWT.encode(payload, key, 'ES256', header)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.get(url)
|
21
|
+
uri = URI(url)
|
22
|
+
|
23
|
+
https = Net::HTTP.new(uri.host, uri.port)
|
24
|
+
https.use_ssl = true
|
25
|
+
|
26
|
+
request = Net::HTTP::Get.new(uri)
|
27
|
+
jwt_token = token
|
28
|
+
request['authorization'] = "Bearer #{jwt_token}"
|
29
|
+
|
30
|
+
https.request(request)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/lhj/lhj.rb
CHANGED
@@ -8,6 +8,7 @@ module Lhj
|
|
8
8
|
require 'lhj/ui/ui'
|
9
9
|
require 'lhj/config'
|
10
10
|
require 'lhj/helper/jenkins_config'
|
11
|
+
require 'lhj/helper/apple/apple_jwt_config'
|
11
12
|
require 'lhj/helper/pod_repo_config'
|
12
13
|
require 'lhj/helper/git_branch_feature_config'
|
13
14
|
require 'lhj/helper/erb_template_helper'
|
data/lib/lhj/version.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lihaijian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xcodeproj
|
@@ -381,6 +381,8 @@ 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_jwt_config.rb
|
385
|
+
- lib/lhj/helper/apple/token.rb
|
384
386
|
- lib/lhj/helper/bugly_helper.rb
|
385
387
|
- lib/lhj/helper/dingtalk_config.rb
|
386
388
|
- lib/lhj/helper/dingtalk_helper.rb
|