fastlane-plugin-zhuixi_build_app 0.1.6 → 0.1.9

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: 1ffb99373c764043027ea9d2411e7ffd94f6e4ac8be257f60f68a0af7f1e84ab
4
- data.tar.gz: 40d2afbbc5d185cda45208d0563a85187500d41f1fbe72408a438c9be9ee3ecb
3
+ metadata.gz: 529bdf9e85e5e3d03ae548d237eb467e4519ea27176df36df46f6f574ef6e7e7
4
+ data.tar.gz: df7ddc010651f6ebbb44f6fd91cbf1fe65f53aabbcc3636784846e35bdd358c6
5
5
  SHA512:
6
- metadata.gz: 20fee2373a5c18157e2860986807b9abf0c1d0566d3e94be23bfbde14ffd0f439c6e62825e4291810a33b7c6737d0c0dadab1488234c7468061e71ca34d9e4d8
7
- data.tar.gz: b747b31452e87bbaffc2ef917256dfa9f940741da3a5531caa9c66204cc81c2e62124415e557f535056acfebd49e95c3087bdf13c2ea8effdde560216e73cdfe
6
+ metadata.gz: 7c5e809eb35175040c07b4bc623963e4e1eafeca9fd242c8c6612001e74907e2617a013a0c0dcf99dc8cc0a95e624542e125e7a4eefbf163f873662e19e8a5ec
7
+ data.tar.gz: c178d4fbc23bf881b7f69c1ce4da6edd91b01a800930a52e3a9fd7cb2efe50cb4ec65162ed9850450680462af73529196840df9c5e44a7cfae7421f4d5020c63
@@ -0,0 +1,63 @@
1
+ module Fastlane
2
+ module Actions
3
+ class LoginAction < Action
4
+ def self.run(params)
5
+ login_and_get_user_id_and_token(params[:credentials][:account], params[:credentials][:password], "2")
6
+ end
7
+
8
+ def login_and_get_user_id_and_token(account, password, packet_os)
9
+ uri = URI.parse("http://xg.yutennet.com/issuesy/pack/user_login")
10
+ request = Net::HTTP::Post.new(uri)
11
+ request.content_type = "application/json"
12
+ request.body = JSON.dump({
13
+ "account" => account,
14
+ "password" => password,
15
+ "packet_os" => packet_os,
16
+ })
17
+
18
+ response = Net::HTTP.start(uri.hostname, uri.port) do |http|
19
+ http.request(request)
20
+ end
21
+
22
+ if response.code == "200"
23
+ result = JSON.parse(response.body)
24
+ if result["code"] == 200
25
+ user_id = result["data"]["user_id"]
26
+ token = result["data"]["token"]
27
+ platforms = result["data"]["platform_lists"]
28
+ puts "登陆成功:platform:" + platforms.to_s
29
+ for platform in platforms
30
+ if @selectPlatformName == platform["platform_name"]
31
+ platformId = platform["platform_id"]
32
+ return user_id, token, platformId
33
+ end
34
+ end
35
+ else
36
+ puts "登录失败:#{result["msg"]}"
37
+ end
38
+ else
39
+ puts "登录失败:HTTP #{response.code}"
40
+ end
41
+
42
+ return nil, nil
43
+ end
44
+
45
+ def self.available_options
46
+ [
47
+ FastlaneCore::ConfigItem.new(key: :credentials,
48
+ env_name: "ZHUIXI_BUILD_APP_YOUR_OPTION",
49
+ description: "LoginAction",
50
+ optional: false,
51
+ type: String),
52
+ ]
53
+ end
54
+ def self.is_supported?(platform)
55
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
56
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
57
+ #
58
+ # [:ios, :mac, :android].include?(platform)
59
+ true
60
+ end
61
+ end
62
+ end
63
+ end
@@ -3,7 +3,6 @@ module Fastlane
3
3
  class ReadConfigAction < Action
4
4
  def self.run(params)
5
5
  # 读取配置文件
6
- puts "ddd"
7
6
  app_file_path = params[:app_file_path]
8
7
  app_file = File.open(app_file_path).read
9
8
  app_file_config = eval(app_file)
@@ -13,9 +12,15 @@ module Fastlane
13
12
  @selectGameName = app_file_config[:selectGameName]
14
13
  @selectPlatformName = app_file_config[:platform]
15
14
  @ori_xcodeproj_path = app_file_config[:ori_xcodeproj_path]
16
- UI.message("读取配置成功!")
15
+ UI.message("读取配置成功!app_file_path:#{app_file_path}")
16
+ # 返回 account 和 password
17
+ return { account: account, password: password }
17
18
  end
18
19
 
20
+ def self.return_value
21
+ # If your method provides a return value, you can describe here what it does
22
+ "包含账号和密码的哈希表"
23
+ end
19
24
  def self.available_options
20
25
  [
21
26
  FastlaneCore::ConfigItem.new(key: :app_file_path,
@@ -25,6 +30,13 @@ module Fastlane
25
30
  type: String),
26
31
  ]
27
32
  end
33
+ def self.is_supported?(platform)
34
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
35
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
36
+ #
37
+ # [:ios, :mac, :android].include?(platform)
38
+ true
39
+ end
28
40
  end
29
41
  end
30
42
  end
@@ -5,28 +5,16 @@ module Fastlane
5
5
  module Actions
6
6
  class ZhuixiBuildAppAction < Action
7
7
  def self.run(params)
8
- other_action.read_config(
8
+ config = other_action.read_config(
9
9
  app_file_path: params[:app_file_path],
10
10
  )
11
- end
12
-
13
- def self.description
14
- "build ios app from different channel"
15
- end
16
-
17
- def self.authors
18
- ["RedSevenMale"]
11
+ other_action.login(credentials: config)
19
12
  end
20
13
 
21
14
  def self.return_value
22
15
  # If your method provides a return value, you can describe here what it does
23
16
  end
24
17
 
25
- def self.details
26
- # Optional:
27
- "build ios app from different channel"
28
- end
29
-
30
18
  def self.available_options
31
19
  [
32
20
  FastlaneCore::ConfigItem.new(key: :app_file_path,
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module ZhuixiBuildApp
3
- VERSION = "0.1.6"
3
+ VERSION = "0.1.9"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-zhuixi_build_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - RedSevenMale
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-24 00:00:00.000000000 Z
11
+ date: 2023-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -159,6 +159,7 @@ files:
159
159
  - LICENSE
160
160
  - README.md
161
161
  - lib/fastlane/plugin/zhuixi_build_app.rb
162
+ - lib/fastlane/plugin/zhuixi_build_app/actions/login_action.rb
162
163
  - lib/fastlane/plugin/zhuixi_build_app/actions/read_config_action.rb
163
164
  - lib/fastlane/plugin/zhuixi_build_app/actions/zhuixi_build_app_action.rb
164
165
  - lib/fastlane/plugin/zhuixi_build_app/helper/zhuixi_build_app_helper.rb