pindo 4.8.7 → 4.8.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pindo/base/githelper.rb +21 -0
  3. data/lib/pindo/client/pgyerclient.rb +34 -1
  4. data/lib/pindo/client/unityhelper.rb +179 -0
  5. data/lib/pindo/command/android/debug.rb +73 -0
  6. data/lib/pindo/command/android.rb +14 -0
  7. data/lib/pindo/command/deploy/build.rb +2 -3
  8. data/lib/pindo/command/dev/autobuild.rb +2 -0
  9. data/lib/pindo/command/dev/build.rb +4 -1
  10. data/lib/pindo/command/dev/debug.rb +25 -15
  11. data/lib/pindo/command/gplay/iap.rb +43 -0
  12. data/lib/pindo/command/gplay/itcapp.rb +41 -0
  13. data/lib/pindo/command/gplay/metadata.rb +43 -0
  14. data/lib/pindo/command/gplay/screenshots.rb +43 -0
  15. data/lib/pindo/command/gplay/upload.rb +40 -0
  16. data/lib/pindo/command/gplay.rb +17 -0
  17. data/lib/pindo/command/ios/adhoc.rb +190 -0
  18. data/lib/pindo/command/ios/applovin.rb +241 -0
  19. data/lib/pindo/command/ios/autoresign.rb +164 -0
  20. data/lib/pindo/command/ios/build.rb +115 -0
  21. data/lib/pindo/command/ios/cert.rb +164 -0
  22. data/lib/pindo/command/ios/debug.rb +195 -0
  23. data/lib/pindo/command/ios.rb +18 -0
  24. data/lib/pindo/command/pgyer/apptest.rb +5 -1
  25. data/lib/pindo/command/pgyer/upload.rb +4 -4
  26. data/lib/pindo/command/unity/apk.rb +78 -0
  27. data/lib/pindo/command/unity/ipa.rb +152 -0
  28. data/lib/pindo/command/unity.rb +16 -0
  29. data/lib/pindo/command.rb +3 -1
  30. data/lib/pindo/module/appselect.rb +4 -0
  31. data/lib/pindo/module/cert/xcodecerthelper.rb +2 -2
  32. data/lib/pindo/module/pgyer/pgyerhelper.rb +47 -7
  33. data/lib/pindo/module/xcode/xcodehelper.rb +1 -1
  34. data/lib/pindo/options/deployoptions.rb +4 -0
  35. data/lib/pindo/version.rb +1 -1
  36. data/lib/pindo.rb +1 -0
  37. metadata +22 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24b5673e6e6b22077a55006939dc549e2b545537d935c6a004bed385dd936014
4
- data.tar.gz: 699659aa13cff6c29fd5cbf63ba1a16707cb1ba6e8811f913094c968d4fcd09a
3
+ metadata.gz: 3d618bb3feb5391c7e4c64105f4f34e72fd542421da102a97e7436ed5d02261c
4
+ data.tar.gz: 829babd10a742d61b622e248aa79429c6930f084dfcf90206540fe0fd9b64cf5
5
5
  SHA512:
6
- metadata.gz: 1ae0851cb8497f852602e3fe26c49f6a1e69e0ba922c44833cf43abe12c186b6d1fec343ac29c3d62c1299c841dda8b0a0782caec8c952885a2fb9c1b0bd4805
7
- data.tar.gz: 7ba1a294c60d4d1633e0f136a04d24712f7b01aec7c0702e890b8d7325e0261497897a67fbe55e1a9f63faaec566e70e8f98d52081c75c134bfbd3bd6953077a
6
+ metadata.gz: f443d03a4934fc8ac2d31ec39bb3ad861a62c28bdd6542a434511cfe1d92f0cb8a6e35736809414e5b564fcec86b0d6393e65d70cec686cd64e518a334ac0277
7
+ data.tar.gz: dd3b27fbcbc5b0392371d6e84feb14a9ece7241b940d7bfc162651d3eee3dd0a74998a5631bb5bb6d9c3115c222d4efff7de3f7df9cb24e85835ba101676ee46
@@ -19,6 +19,27 @@ module Pindo
19
19
 
20
20
  end
21
21
 
22
+ def is_git_directory?(local_repo_dir: nil)
23
+ args = local_repo_dir ? %W(-C #{local_repo_dir} rev-parse --is-inside-work-tree) : %w(rev-parse --is-inside-work-tree)
24
+ begin
25
+ git!(args)
26
+ true
27
+ rescue StandardError => e
28
+ false
29
+ end
30
+ end
31
+
32
+ def git_root_directory(local_repo_dir: nil)
33
+ return nil unless is_git_directory?(local_repo_dir: local_repo_dir)
34
+
35
+ args = local_repo_dir ? %W(-C #{local_repo_dir} rev-parse --show-toplevel) : %w(rev-parse --show-toplevel)
36
+ begin
37
+ git!(args).strip
38
+ rescue StandardError => e
39
+ nil
40
+ end
41
+ end
42
+
22
43
  def add_branch(local_repo_dir: nil, branch: nil)
23
44
 
24
45
  current=Dir.pwd
@@ -180,7 +180,7 @@ module Pindo
180
180
  else
181
181
  Funlog.instance.fancyinfo_error("pgyer token文件不存在!")
182
182
  end
183
-
183
+ puts "token: #{@token}"
184
184
  return @token
185
185
  end
186
186
 
@@ -494,5 +494,38 @@ module Pindo
494
494
 
495
495
  end
496
496
 
497
+ def post_message(appId:nil, appVersionId:nil, chatEnv: nil, receiveType:nil)
498
+
499
+ boss_url = @baseurl + @request_config["send_lark_message"]
500
+
501
+ body_params = {
502
+ appId:appId,
503
+ appVersionId:appVersionId,
504
+ chatEnv:chatEnv,
505
+ receiveType:receiveType
506
+ }
507
+
508
+
509
+ con = HttpClient.create_instance_with_proxy
510
+
511
+ res = con.post do |req|
512
+ req.url boss_url
513
+ req.headers['Content-Type'] = 'application/json'
514
+ req.headers['token'] = @token["token"]
515
+ req.body = body_params.to_json
516
+ end
517
+
518
+
519
+ result_date = nil
520
+ if !res.body.nil?
521
+ result_date = JSON.parse(res.body)
522
+ end
523
+
524
+ puts JSON.pretty_generate(result_date)
525
+
526
+ return result_date
527
+
528
+ end
529
+
497
530
  end
498
531
  end
@@ -0,0 +1,179 @@
1
+ require 'open3'
2
+ require 'json'
3
+ require 'singleton'
4
+
5
+ module Pindo
6
+ module Client
7
+ class UnityHelper
8
+ include Singleton
9
+
10
+ UNITY_MAC_PATHS = [
11
+ "/Applications/Unity/Unity.app/Contents/MacOS/Unity",
12
+ "/Applications/Unity/Hub/Editor/*/Unity.app/Contents/MacOS/Unity"
13
+ ]
14
+
15
+ UNITY_WINDOWS_PATHS = [
16
+ "C:/Program Files/Unity/Editor/Unity.exe",
17
+ "C:/Program Files/Unity/Hub/Editor/*/Unity.exe"
18
+ ]
19
+
20
+ TARGET_UNITY_VERSION = "2021.3"
21
+
22
+ class << self
23
+ def share_instance
24
+ instance
25
+ end
26
+ end
27
+
28
+ def find_unity_path
29
+ paths = case RUBY_PLATFORM
30
+ when /darwin/
31
+ UNITY_MAC_PATHS
32
+ when /mswin|mingw|windows/
33
+ UNITY_WINDOWS_PATHS
34
+ else
35
+ raise "Unsupported platform: #{RUBY_PLATFORM}"
36
+ end
37
+
38
+ unity_versions = []
39
+
40
+ paths.each do |path|
41
+ if path.include?("*")
42
+ Dir.glob(path).each do |expanded_path|
43
+ # 从路径中提取版本号
44
+ version = extract_version_from_path(expanded_path)
45
+ if version && version.start_with?(TARGET_UNITY_VERSION)
46
+ unity_versions << {
47
+ path: expanded_path,
48
+ version: version
49
+ }
50
+ end
51
+ end
52
+ elsif File.exist?(path)
53
+ version = extract_version_from_path(path)
54
+ if version && version.start_with?(TARGET_UNITY_VERSION)
55
+ unity_versions << {
56
+ path: path,
57
+ version: version
58
+ }
59
+ end
60
+ end
61
+ end
62
+
63
+ if unity_versions.empty?
64
+ raise "No Unity #{TARGET_UNITY_VERSION} found in standard locations"
65
+ end
66
+
67
+ # 按版本号排序,取最新的2021.3.x版本
68
+ selected_unity = unity_versions.sort_by { |v| Gem::Version.new(v[:version]) }.last
69
+ puts "Selected Unity version: #{selected_unity[:version]}"
70
+ selected_unity[:path]
71
+ end
72
+
73
+ private
74
+
75
+ def extract_version_from_path(path)
76
+ # macOS路径格式: /Applications/Unity/Hub/Editor/2021.3.45f1/Unity.app/Contents/MacOS/Unity
77
+ # Windows路径格式: C:/Program Files/Unity/Hub/Editor/2021.3.45f1/Editor/Unity.exe
78
+ if match = path.match(/Editor\/([\d.]+[a-zA-Z]\d+)\//)
79
+ match[1]
80
+ else
81
+ nil
82
+ end
83
+ end
84
+
85
+ public
86
+
87
+ def execute_unity_command(project_path, method_name, additional_args = {})
88
+ unity_path = find_unity_path
89
+
90
+ cmd_args = [
91
+ unity_path,
92
+ "-batchmode",
93
+ "-quit",
94
+ "-projectPath",
95
+ project_path.to_s,
96
+ "-executeMethod",
97
+ method_name
98
+ ]
99
+
100
+ # Add any additional arguments
101
+ additional_args.each do |key, value|
102
+ cmd_args << "-#{key}"
103
+ cmd_args << value.to_s if value
104
+ end
105
+
106
+ puts "Executing Unity command: #{cmd_args.join(' ')}"
107
+ stdout, stderr, status = Open3.capture3(*cmd_args)
108
+
109
+ {
110
+ success: status.success?,
111
+ stdout: stdout,
112
+ stderr: stderr,
113
+ exit_status: status.exitstatus,
114
+ unity_version: extract_version_from_path(unity_path)
115
+ }
116
+ end
117
+
118
+ def build_project(project_path, build_method, platform: nil, output_path: nil)
119
+ additional_args = {}
120
+ additional_args[:buildTarget] = platform if platform
121
+ additional_args[:outputPath] = output_path if output_path
122
+
123
+ result = execute_unity_command(project_path, build_method, additional_args)
124
+
125
+ if result[:success]
126
+ puts "Unity build completed successfully"
127
+ puts "Using Unity version: #{result[:unity_version]}"
128
+ puts result[:stdout]
129
+ else
130
+ puts "Unity build failed"
131
+ puts "Unity version: #{result[:unity_version]}"
132
+ puts result[:stderr]
133
+ raise "Unity build failed with status: #{result[:exit_status]}"
134
+ end
135
+
136
+ result
137
+ end
138
+
139
+ def get_project_settings(project_path)
140
+ settings_path = File.join(project_path, "ProjectSettings", "ProjectSettings.asset")
141
+ if File.exist?(settings_path)
142
+ File.read(settings_path)
143
+ else
144
+ raise "Project settings file not found at #{settings_path}"
145
+ end
146
+ end
147
+
148
+ def get_unity_version(project_path)
149
+ version_path = File.join(project_path, "ProjectSettings", "ProjectVersion.txt")
150
+ if File.exist?(version_path)
151
+ content = File.read(version_path)
152
+ if content =~ /m_EditorVersion: (.*)/
153
+ version = $1.strip
154
+ unless version.start_with?(TARGET_UNITY_VERSION)
155
+ raise "Project Unity version (#{version}) does not match required version (#{TARGET_UNITY_VERSION}.x)"
156
+ end
157
+ version
158
+ else
159
+ raise "Could not parse Unity version from #{version_path}"
160
+ end
161
+ else
162
+ raise "Project version file not found at #{version_path}"
163
+ end
164
+ end
165
+
166
+ def verify_unity_version(project_path)
167
+ project_version = get_unity_version(project_path)
168
+ unity_path = find_unity_path
169
+ editor_version = extract_version_from_path(unity_path)
170
+
171
+ if project_version != editor_version
172
+ raise "Project Unity version (#{project_version}) does not match Editor version (#{editor_version})"
173
+ end
174
+
175
+ true
176
+ end
177
+ end
178
+ end
179
+ end
@@ -0,0 +1,73 @@
1
+ require 'fileutils'
2
+
3
+ module Pindo
4
+ class Command
5
+ class Android < Command
6
+ class Debug < Android
7
+
8
+ # Android Debug包编译和上传命令
9
+ self.summary = '编译Android Debug包并支持上传到测试平台'
10
+
11
+ # 详细说明
12
+ self.description = <<-DESC
13
+ 编译Android Debug包并支持上传到测试平台。
14
+
15
+ 支持功能:
16
+
17
+ * 编译Debug包
18
+
19
+ * 上传到测试平台
20
+
21
+ * 发送测试通知
22
+
23
+ 使用示例:
24
+
25
+ $ pindo android debug # 编译Debug包
26
+
27
+ $ pindo android debug --upload # 编译并上传
28
+
29
+ $ pindo android debug --send # 编译上传并发送通知
30
+
31
+ $ pindo android debug --proj=myapp # 指定项目名称
32
+
33
+ DESC
34
+
35
+ # 命令参数
36
+ self.arguments = [
37
+ # 暂无参数
38
+ ]
39
+
40
+ # 命令选项
41
+ def self.options
42
+ [
43
+ ['--proj', '指定上传到测试平台的项目名称'],
44
+ ['--upload', '上传编译后的apk到测试平台'],
45
+ ['--send', '上传成功后发送测试通知']
46
+ ].concat(super)
47
+ end
48
+
49
+ def initialize(argv)
50
+ @args_adhoc_flag = argv.flag?('adhoc', false)
51
+ @args_deploy_flag = argv.flag?('deploy', false)
52
+ @args_macos_flag = argv.flag?('macos', false)
53
+ @upload_flag = argv.flag?('upload', false)
54
+ @send_flag = argv.flag?('send', false)
55
+ @proj_name = argv.option('proj')
56
+
57
+ if @send_flag
58
+ @upload_flag = true
59
+ end
60
+
61
+ super
62
+ end
63
+
64
+ def run
65
+ # TODO: 实现编译和上传逻辑
66
+ puts "Android Debug包编译和上传命令"
67
+
68
+ end
69
+
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,14 @@
1
+
2
+
3
+ require 'pindo/command/android/debug'
4
+
5
+ module Pindo
6
+ class Command
7
+
8
+ class Android < Command
9
+ self.abstract_command = true
10
+ self.summary = 'Android相关命令'
11
+ end
12
+
13
+ end
14
+ end
@@ -77,13 +77,12 @@ module Pindo
77
77
  config = FastlaneCore::Configuration.create(Gym::Options.available_options, gym_options)
78
78
  Gym::Manager.new.work(config)
79
79
 
80
-
81
-
82
80
  pindo_new_project_dir = Dir.pwd
83
81
  build_path = File.join(pindo_new_project_dir, "build", "*.ipa")
84
82
  ipa_file_upload = Dir.glob(build_path).max_by {|f| File.mtime(f)}
85
-
83
+
86
84
  if !ipa_file_upload.nil? && !app_info_obj.nil?
85
+
87
86
  description = nil
88
87
  result_data = PgyerHelper.share_instace.start_upload(app_info_obj:app_info_obj, ipa_file_upload:ipa_file_upload, description:description)
89
88
  if !result_data.nil? && !result_data["data"].nil? && !result_data["data"]["id"].nil?
@@ -69,6 +69,8 @@ module Pindo
69
69
 
70
70
  args_temp = []
71
71
  args_temp << mainapp_bundleid
72
+
73
+
72
74
  Pindo::Command::Deploy::Pullconfig::run(args_temp)
73
75
 
74
76
  project_dir = Dir.pwd
@@ -53,12 +53,13 @@ module Pindo
53
53
  app_info_obj = PgyerHelper.share_instace.prepare_upload(working_directory:Dir.pwd, proj_name:proj_name)
54
54
  end
55
55
 
56
+
56
57
  args_temp = []
57
58
  Pindo::Command::Deploy::Build::run(args_temp)
58
59
 
59
60
 
60
61
  pindo_new_project_dir = Dir.pwd
61
- build_path = File.join(pindo_new_project_dir, "build", "*.{ipa,app}")
62
+ build_path = File.join(pindo_new_project_dir, "build", "*.{ipa,app,apk}")
62
63
  ipa_file_upload = Dir.glob(build_path).max_by {|f| File.mtime(f)}
63
64
 
64
65
  if !ipa_file_upload.nil? && !app_info_obj.nil?
@@ -74,9 +75,11 @@ module Pindo
74
75
  end
75
76
  end
76
77
  end
78
+
77
79
  result_data = PgyerHelper.share_instace.start_upload(app_info_obj:app_info_obj, ipa_file_upload:ipa_file_upload, description:description)
78
80
  if !result_data.nil? && !result_data["data"].nil? && !result_data["data"]["id"].nil?
79
81
  msg_data = PgyerHelper.share_instace.make_msg_data(app_info_obj:app_info_obj, app_version_info_obj:result_data["data"])
82
+
80
83
  PgyerHelper.share_instace.print_app_version_info(msg_data:msg_data)
81
84
  if @args_send_flag
82
85
  PgyerHelper.share_instace.send_apptest_wechat_msg(msg_data:msg_data)
@@ -12,22 +12,38 @@ module Pindo
12
12
  self.summary = '更新证书并使用新证书设置工程'
13
13
 
14
14
  self.description = <<-DESC
15
+ 更新证书并使用新证书设置工程。
15
16
 
16
- 更新证书并使用新证书设置工程,如果在工程目录下执行,会自动给工程设置对应的证书。用法:pindo dev debug 默认使用开发bundle id, 使用dev证书。
17
- 使用发布相关bundle id 或者adhoc证书,用法如下:pindo dev debug --deploy --adhoc
18
-
17
+ 支持功能:
18
+
19
+ * 自动更新证书
20
+
21
+ * 自动设置工程证书
22
+
23
+ * 支持开发和发布证书
24
+
25
+ * 支持iOS和macOS平台
26
+
27
+ 使用示例:
28
+
29
+ $ pindo dev debug # 使用开发证书
30
+
31
+ $ pindo dev debug --deploy # 使用发布bundle id
32
+
33
+ $ pindo dev debug --adhoc # 使用adhoc证书
34
+
35
+ $ pindo dev debug --macos # 使用macOS证书
19
36
  DESC
20
37
 
21
38
  self.arguments = [
22
-
39
+ # 暂无参数
23
40
  ]
24
41
 
25
42
  def self.options
26
43
  [
27
- ['--deploy', '默认用开发的bundle id,使用--deploy设置使用发布bundle id'],
28
- ['--adhoc', '默认用dev证书,使用--adhoc设置使用adhoc证书'],
29
- ['--macos', 'macos平台证书'],
30
- ['--upload', '生成上传pgyer的证书'],
44
+ ['--deploy', '使用发布bundle id(默认使用开发bundle id)'],
45
+ ['--adhoc', '使用adhoc证书(默认使用dev证书)'],
46
+ ['--macos', '使用macOS平台证书'],
31
47
  ].concat(super)
32
48
  end
33
49
 
@@ -35,7 +51,6 @@ module Pindo
35
51
  @args_adhoc_flag = argv.flag?('adhoc', false)
36
52
  @args_deploy_flag = argv.flag?('deploy', false)
37
53
  @args_macos_flag = argv.flag?('macos', false)
38
- @upload_flag = argv.flag?('upload', false)
39
54
  super
40
55
  end
41
56
 
@@ -80,10 +95,6 @@ module Pindo
80
95
  if @args_macos_flag
81
96
  args_temp << "--macos"
82
97
  end
83
-
84
- if @upload_flag
85
- args_temp << "--upload"
86
- end
87
98
 
88
99
  Pindo::Command::Deploy::Cert::run(args_temp)
89
100
 
@@ -145,5 +156,4 @@ module Pindo
145
156
  end
146
157
  end
147
158
  end
148
- end
149
-
159
+ end
@@ -0,0 +1,43 @@
1
+ require 'highline/import'
2
+ require 'xcodeproj'
3
+ require 'find'
4
+ require 'fileutils'
5
+
6
+ module Pindo
7
+ class Command
8
+ class Appstore < Command
9
+ class Iap < Appstore
10
+
11
+
12
+ self.summary = 'Appstore中iap相关操作'
13
+
14
+ self.description = <<-DESC
15
+ Appstore中iap相关操作,配置目录下执行:pindo appstore iap, 默认创建iap购买项
16
+ DESC
17
+
18
+ self.arguments = [
19
+ CLAide::Argument.new('path/to/config.json', false),
20
+ ]
21
+
22
+ def self.options
23
+ [
24
+ ['--download', '下载app的所有购买项,用法:pindo appstore iap --download'],
25
+ ].concat(super)
26
+ end
27
+
28
+ def initialize(argv)
29
+
30
+ @args_download_name = argv.option('download')
31
+
32
+ super
33
+ end
34
+
35
+
36
+ def run
37
+
38
+ end
39
+
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,41 @@
1
+ require 'highline/import'
2
+ require 'xcodeproj'
3
+ require 'find'
4
+ require 'fileutils'
5
+
6
+ module Pindo
7
+ class Command
8
+ class Appstore < Command
9
+ class Itcapp < Appstore
10
+
11
+
12
+ self.summary = 'Appstore中创建app'
13
+
14
+ self.description = <<-DESC
15
+ Appstore中创建app,配置目录下执行:pindo appstore itcapp
16
+ DESC
17
+
18
+ self.arguments = [
19
+ CLAide::Argument.new('path/to/config.json', false),
20
+ ]
21
+
22
+ def self.options
23
+ [
24
+
25
+ ].concat(super)
26
+ end
27
+
28
+ def initialize(argv)
29
+
30
+ super
31
+ end
32
+
33
+
34
+ def run
35
+
36
+ end
37
+
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,43 @@
1
+ require 'highline/import'
2
+ require 'xcodeproj'
3
+ require 'find'
4
+ require 'fileutils'
5
+
6
+ module Pindo
7
+ class Command
8
+ class Appstore < Command
9
+ class Metadata < Appstore
10
+
11
+
12
+ self.summary = 'Appstore中metadata相关操作'
13
+
14
+ self.description = <<-DESC
15
+ Appstore中metadata相关操作, 用法:pindo appstre metadata
16
+ DESC
17
+
18
+ self.arguments = [
19
+ CLAide::Argument.new('path/to/config.json', false),
20
+ ]
21
+
22
+ def self.options
23
+ [
24
+ ['--download', '下载app的所有购买项,用法:pindo appstore metadata --download'],
25
+ ].concat(super)
26
+ end
27
+
28
+ def initialize(argv)
29
+
30
+ @args_download_name = argv.option('download')
31
+
32
+ super
33
+ end
34
+
35
+
36
+ def run
37
+
38
+ end
39
+
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,43 @@
1
+ require 'highline/import'
2
+ require 'xcodeproj'
3
+ require 'find'
4
+ require 'fileutils'
5
+
6
+ module Pindo
7
+ class Command
8
+ class Appstore < Command
9
+ class Screenshots < Appstore
10
+
11
+
12
+ self.summary = 'Appstore中screenshots相关操作'
13
+
14
+ self.description = <<-DESC
15
+ Appstore中screenshots相关操作, 用法:pindo appstre screenshots
16
+ DESC
17
+
18
+ self.arguments = [
19
+ CLAide::Argument.new('path/to/config.json', false),
20
+ ]
21
+
22
+ def self.options
23
+ [
24
+ ['--download', '下载app的所有购买项,用法:pindo appstore screenshots --download'],
25
+ ].concat(super)
26
+ end
27
+
28
+ def initialize(argv)
29
+
30
+ @args_download_name = argv.option('download')
31
+
32
+ super
33
+ end
34
+
35
+
36
+ def run
37
+
38
+ end
39
+
40
+ end
41
+ end
42
+ end
43
+ end