pindo 4.9.2 → 4.9.4

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.
@@ -1,5 +1,3 @@
1
-
2
-
3
1
  require 'highline/import'
4
2
  require 'fileutils'
5
3
  require 'pindo/module/pgyer/pgyerhelper'
@@ -15,7 +13,21 @@ module Pindo
15
13
  self.summary = '从pgyer下载指定app的安装包'
16
14
 
17
15
  self.description = <<-DESC
18
- 从pgyer下载指定app的安装包。终端直接运行:pindo pgyer download
16
+ 从pgyer下载指定app的安装包。
17
+
18
+ 支持功能:
19
+
20
+ * 下载指定版本安装包
21
+ * 查看历史版本
22
+ * 显示下载进度
23
+
24
+ 使用示例:
25
+
26
+ $ pindo pgyer download # 下载当前目录项目的最新版本
27
+
28
+ $ pindo pgyer download --proj=demo # 下载指定项目的安装包
29
+
30
+ $ pindo pgyer download --list # 列出历史版本供选择下载
19
31
  DESC
20
32
 
21
33
  self.arguments = [
@@ -1,5 +1,3 @@
1
-
2
-
3
1
  require 'highline/import'
4
2
  require 'fileutils'
5
3
  require 'pindo/module/pgyer/pgyerhelper'
@@ -11,10 +9,22 @@ module Pindo
11
9
 
12
10
  class Login < Pgyer
13
11
 
14
- self.summary = '登录pgyer'
12
+ self.summary = '登录pgyer测试平台'
15
13
 
16
14
  self.description = <<-DESC
17
- 登录pgyer,终端运行:pindo pgyer login
15
+ 登录pgyer测试平台。
16
+
17
+ 支持功能:
18
+
19
+ * 账号密码登录
20
+ * 记住登录状态
21
+ * 强制重新登录
22
+
23
+ 使用示例:
24
+
25
+ $ pindo pgyer login # 登录pgyer
26
+
27
+ $ pindo pgyer login --force # 强制重新登录
18
28
  DESC
19
29
 
20
30
  self.arguments = [
@@ -1,5 +1,3 @@
1
-
2
-
3
1
  require 'highline/import'
4
2
  require 'fileutils'
5
3
  require 'pindo/module/pgyer/pgyerhelper'
@@ -10,10 +8,28 @@ module Pindo
10
8
  class Resign < Pgyer
11
9
 
12
10
 
13
- self.summary = '获取pgyer中指定app的测试链接和二维码'
11
+ self.summary = '重签名pgyer中的安装包'
14
12
 
15
13
  self.description = <<-DESC
16
- 获取pgyer中指定app的测试链接和二维码,终端运行:pindo pgyer resign
14
+ 重签名pgyer中的安装包。
15
+
16
+ 支持功能:
17
+
18
+ * 选择证书重签名
19
+ * 查看历史版本
20
+ * 发送测试信息
21
+
22
+ 使用示例:
23
+
24
+ $ pindo pgyer resign # 重签名当前项目最新版本
25
+
26
+ $ pindo pgyer resign --proj=demo # 重签名指定项目
27
+
28
+ $ pindo pgyer resign --list # 列出历史版本供选择
29
+
30
+ $ pindo pgyer resign --certid=xxx # 使用指定证书重签名
31
+
32
+ $ pindo pgyer resign --send # 重签名后发送测试信息
17
33
  DESC
18
34
 
19
35
  self.arguments = [
@@ -1,11 +1,9 @@
1
-
2
-
3
1
  require 'highline/import'
4
2
  require 'fileutils'
5
3
  require 'json'
6
4
  require 'faraday'
7
5
  require 'pindo/module/pgyer/pgyerhelper'
8
-
6
+ require 'pindo/module/build/buildhelper'
9
7
 
10
8
  module Pindo
11
9
  class Command
@@ -13,10 +11,32 @@ module Pindo
13
11
  class Upload < Pgyer
14
12
 
15
13
 
16
- self.summary = '上传ipa包到pgyer测试网站'
14
+ self.summary = '上传安装包到pgyer测试平台'
17
15
 
18
16
  self.description = <<-DESC
19
- 上传ipa包到pgyer。用法:例如:pindo pgyer upload path/to/demo.ipa
17
+ 上传安装包到pgyer测试平台。
18
+
19
+ 支持功能:
20
+
21
+ * 上传ipa/apk安装包
22
+ * 添加版本描述
23
+ * 上传附件
24
+ * 重签名
25
+ * 发送测试信息
26
+
27
+ 使用示例:
28
+
29
+ $ pindo pgyer upload path/to/app.ipa # 上传指定安装包
30
+
31
+ $ pindo pgyer upload --proj=demo # 上传到指定项目
32
+
33
+ $ pindo pgyer upload --desc="版本说明" # 添加版本描述
34
+
35
+ $ pindo pgyer upload --attach=file.zip # 上传附件
36
+
37
+ $ pindo pgyer upload --resign # 上传后重签名
38
+
39
+ $ pindo pgyer upload --send # 上传后发送企业微信测试信息
20
40
  DESC
21
41
 
22
42
  self.arguments = [
@@ -33,7 +53,7 @@ module Pindo
33
53
  ['--desc', '指定上传的备注信息: -pindo pgyer upload -desc="1.upload message"'],
34
54
  ['--resign', '上传到之后是否重签名,用法:pindo pgyer upload --resign'],
35
55
  ['--certid', '设置重签名的正式id,用法:pindo pgyer upload --certid=com.test.bundleid'],
36
-
56
+
37
57
  ].concat(super)
38
58
  end
39
59
 
@@ -85,9 +105,33 @@ module Pindo
85
105
  def run
86
106
 
87
107
  current_project_dir = Dir.pwd
108
+
88
109
  if @args_ipa_file.nil? || !File.exist?(@args_ipa_file)
89
- build_path = File.join(current_project_dir, "build", "*.{ipa,app,apk}")
90
- @args_ipa_file = Dir.glob(build_path).max_by {|f| File.mtime(f)}
110
+ # 获取build目录下的ipa文件
111
+ #
112
+ build_helper = Pindo::BuildHelper.share_instance
113
+ project_type = build_helper.project_type(current_project_dir)
114
+ case project_type
115
+ when :ios
116
+ build_path = File.join(current_project_dir, "build", "*.{ipa,app}")
117
+ @args_ipa_file = Dir.glob(build_path).max_by {|f| File.mtime(f)}
118
+ when :android
119
+ build_path = File.join(current_project_dir, "build", "*.{apk}")
120
+ @args_ipa_file = Dir.glob(build_path).max_by {|f| File.mtime(f)}
121
+ when :unity
122
+
123
+ if File.exist?(File.join(current_project_dir, "GoodPlatform/BaseiOS"))
124
+ build_path = File.join(current_project_dir, "GoodPlatform/BaseiOS/build", "*.{ipa,app}")
125
+ @args_ipa_file = Dir.glob(build_path).max_by {|f| File.mtime(f)}
126
+ else
127
+ build_path = File.join(current_project_dir, "GoodPlatform/iOS/build", "*.{ipa,app}")
128
+ @args_ipa_file = Dir.glob(build_path).max_by {|f| File.mtime(f)}
129
+ end
130
+ else
131
+ raise Informative, "当前目录不是工程目录,不能编译"
132
+ end
133
+
134
+
91
135
  if @args_ipa_file.nil?
92
136
  build_path = File.join(current_project_dir, "*.{ipa,app,apk}")
93
137
  @args_ipa_file = Dir.glob(build_path).max_by {|f| File.mtime(f)}
@@ -4,6 +4,7 @@ require 'find'
4
4
  require 'fileutils'
5
5
  require 'pindo/base/executable'
6
6
  require 'pindo/module/build/unityhelper'
7
+ require 'pindo/module/build/buildhelper'
7
8
 
8
9
  module Pindo
9
10
  class Command
@@ -11,7 +12,8 @@ module Pindo
11
12
  class Ipa < Unity
12
13
 
13
14
  include Appselect
14
-
15
+
16
+ include Pindo::Githelper
15
17
  # Unity IPA包编译和上传命令
16
18
  self.summary = '编译Unity工程生成iOS IPA并支持上传到测试平台'
17
19
 
@@ -71,67 +73,39 @@ module Pindo
71
73
 
72
74
  super
73
75
  end
74
-
75
- def export_ios_project(project_path, pindo_ios_project_dir, additional_args)
76
-
77
- # 获取 UnityHelper 实例
78
- unity_helper = Pindo::Client::UnityHelper.share_instance
79
- # 获取 Unity 版本
80
- unity_version = unity_helper.find_unity_path
81
- puts "Unity 版本: #{unity_version}"
82
-
83
- begin
84
-
85
- # 执行Unity命令
86
- result = unity_helper.execute_unity_command(
87
- project_path,
88
- 'GoodUnityBuild.BuildManager.BatchBuild',
89
- additional_args
90
- )
91
-
92
- if result[:success]
93
- puts "Unity iOS library build completed successfully"
94
- puts "Unity version: #{result[:unity_version]}"
95
- puts "Output: #{pindo_ios_project_dir}"
96
- puts result[:stdout]
97
- return true
98
- else
99
- puts "Unity iOS library build failed"
100
- puts "Unity version: #{result[:unity_version]}"
101
- puts "Error:"
102
- puts result[:stderr]
103
- raise "Build failed with status: #{result[:exit_status]}"
104
- end
105
-
106
- rescue => e
107
- puts "Error during Unity build: #{e.message}"
108
- puts e.backtrace
109
- return false
110
- end
111
- end
112
76
 
113
77
 
114
78
  def run
79
+
115
80
  pindo_unity_project_dir = Dir.pwd
116
-
81
+
117
82
  # 检查是否是Unity工程
118
83
  unity_helper = Pindo::Client::UnityHelper.share_instance
119
-
120
- if @force_select_unity
121
- puts "强制选择Unity版本"
122
- unity_helper.find_unity_path(change_unity_version:true)
123
- end
124
-
125
84
  unless unity_helper.unity_project?(pindo_unity_project_dir)
126
85
  raise Informative, "当前目录不是Unity工程,请在Unity工程根目录下执行此命令"
127
86
  end
128
-
87
+
88
+ if @args_upload_flag
89
+ build_helper = Pindo::BuildHelper.share_instance
90
+ is_need_add_tag,tag_action_parms = build_helper.check_is_need_add_tag?(pindo_unity_project_dir)
91
+ if is_need_add_tag
92
+ Pindo::Command::Dev::Tag::run(tag_action_parms)
93
+ end
94
+ end
95
+
96
+ project_unity_version = unity_helper.get_unity_version(pindo_unity_project_dir)
97
+ project_unity_major_version = project_unity_version.split('.')[0..1].join('.')
98
+ puts
99
+ puts "工程的Unity版本: #{project_unity_version}"
100
+ unity_exe_path = unity_helper.find_unity_path(unity_major_version:project_unity_major_version, force_change_version: @force_select_unity)
101
+ puts "选择的Unity路径: #{unity_exe_path}"
102
+ puts
103
+
129
104
  app_info_obj = nil
130
105
  if @args_upload_flag
131
106
  proj_name = @args_proj_name
132
107
  app_info_obj = PgyerHelper.share_instace.prepare_upload(working_directory:Dir.pwd, proj_name:proj_name)
133
108
  end
134
- puts app_info_obj
135
109
 
136
110
  mainapp_bundleid= nil
137
111
  if @args_deploy_flag
@@ -140,21 +114,19 @@ module Pindo
140
114
  mainapp_bundleid = get_selected_dev_bundleid()
141
115
  end
142
116
 
143
-
144
- pindo_ios_project_dir = File.join(pindo_unity_project_dir, "GoodPlatform/iOS")
145
- # 准备额外的参数
146
- additional_args = {
147
- 'platform' => 'iOS'
148
- }
149
- if @args_base_flag
150
- pindo_ios_project_dir = File.join(pindo_unity_project_dir, "GoodPlatform/BaseiOS")
151
- additional_args = {
152
- 'platform' => 'iOS',
153
- 'buildtype' => 'library'
154
- }
117
+ isLibrary = @args_base_flag
118
+
119
+ ios_export_lib_dir = File.join(pindo_unity_project_dir, "GoodPlatform/BaseiOS")
120
+ if File.directory?(ios_export_lib_dir)
121
+ isLibrary = true
155
122
  end
156
123
 
157
- export_ios_project(pindo_unity_project_dir, pindo_ios_project_dir, additional_args)
124
+ pindo_ios_project_dir = File.join(pindo_unity_project_dir, "GoodPlatform/iOS")
125
+ if isLibrary
126
+ pindo_ios_project_dir = ios_export_lib_dir
127
+ end
128
+ unity_helper.build_project(unity_exe_full_path:unity_exe_path, project_path:pindo_unity_project_dir, platform:'iOS', isLibrary:isLibrary)
129
+
158
130
 
159
131
  args_temp = []
160
132
  args_temp << "--bundleid=#{mainapp_bundleid}"
@@ -168,14 +140,8 @@ module Pindo
168
140
  end
169
141
 
170
142
  Dir.chdir(pindo_ios_project_dir)
171
- if @args_base_flag
172
- `chmod 777 #{pindo_ios_project_dir}`
173
- else
174
- `chmod 777 #{pindo_ios_project_dir}/Unity`
175
- end
176
143
 
177
-
178
- Pindo::Command::Ios::Debug::run(args_temp)
144
+ Pindo::Command::Ios::Autobuild::run(args_temp)
179
145
 
180
146
 
181
147
  end
data/lib/pindo/command.rb CHANGED
@@ -44,7 +44,6 @@ module Pindo
44
44
  require 'pindo/command/pgyer'
45
45
  require 'pindo/command/setup'
46
46
  require 'pindo/command/repo'
47
- require 'pindo/command/upgrade'
48
47
  require 'pindo/command/ipa'
49
48
  require 'pindo/command/appstore'
50
49
  require 'pindo/command/unity'
@@ -3,10 +3,10 @@ require 'fileutils'
3
3
  require 'xcodeproj' # 用于iOS项目检查
4
4
 
5
5
  module Pindo
6
- module Module
7
- module Build
6
+
8
7
  class BuildHelper
9
8
  include Singleton
9
+ include Pindo::Githelper
10
10
 
11
11
  class << self
12
12
  def share_instance
@@ -14,6 +14,51 @@ module Pindo
14
14
  end
15
15
  end
16
16
 
17
+ def check_is_need_add_tag?(project_path)
18
+ tag_action_parms = nil
19
+ is_need_add_tag = false
20
+
21
+ if is_git_directory?(local_repo_dir: project_path)
22
+ current_git_root_path = git_root_directory(local_repo_dir: project_path)
23
+ latest_tag = get_latest_version_tag(project_dir: current_git_root_path)
24
+
25
+ unless is_tag_at_head?(git_root_dir: current_git_root_path, tag_name: latest_tag)
26
+ cli = HighLine.new
27
+ menu_options = {
28
+ "新增版本号,打新Tag" => -> {
29
+ tag_action_parms = []
30
+ :new_tag
31
+ },
32
+ "将上次的Tag删除重新打Tag" => -> {
33
+ tag_action_parms = []
34
+ tag_action_parms << "--retag"
35
+ :recreate_tag
36
+ },
37
+ "不需要Tag继续编译且上传,手动修改上传备注" => -> {
38
+ puts ""
39
+ :continue_without_tag
40
+ },
41
+ "终止退出编译" => -> {
42
+ raise Informative, "终止退出编译!"
43
+ :exit
44
+ }
45
+ }
46
+
47
+ result = cli.choose do |menu|
48
+ menu.header = "当前代码并没有打Tag,上传的Changelog需要Tag"
49
+ menu.prompt = "请选中打Tag的方式, 请输入选项(1/2/3...):"
50
+ menu_options.each do |option, action|
51
+ menu.choice(option) { action.call }
52
+ end
53
+ end
54
+
55
+ is_need_add_tag = !tag_action_parms.nil?
56
+ end
57
+ end
58
+
59
+ return [is_need_add_tag, tag_action_parms]
60
+ end
61
+
17
62
  def unity_project?(project_path)
18
63
  # 检查Unity工程的关键文件和目录
19
64
  project_settings_path = File.join(project_path, "ProjectSettings")
@@ -138,6 +183,5 @@ module Pindo
138
183
  end
139
184
  end
140
185
  end
141
- end
142
- end
186
+
143
187
  end
@@ -25,7 +25,8 @@ module Pindo
25
25
  end
26
26
  end
27
27
 
28
- def find_unity_path(change_unity_version:false)
28
+ def find_unity_path(unity_major_version:nil, force_change_version:false)
29
+
29
30
  paths = case RUBY_PLATFORM
30
31
  when /darwin/
31
32
  UNITY_MAC_PATHS
@@ -42,101 +43,44 @@ module Pindo
42
43
  Dir.glob(path).each do |expanded_path|
43
44
  version = extract_version_from_path(expanded_path)
44
45
  if version
46
+ major_version = version.split('.')[0..1].join('.')
45
47
  unity_versions << {
46
48
  path: expanded_path,
47
- version: version
49
+ version: version,
50
+ major_version: major_version
48
51
  }
49
52
  end
50
53
  end
51
54
  elsif File.exist?(path)
52
55
  version = extract_version_from_path(path)
56
+ major_version = version.split('.')[0..1].join('.')
53
57
  if version
54
58
  unity_versions << {
55
59
  path: path,
56
- version: version
60
+ version: version,
61
+ major_version: major_version
57
62
  }
58
63
  end
59
64
  end
60
65
  end
61
-
66
+
62
67
  if unity_versions.empty?
63
68
  raise Informative, "未找到任何Unity版本"
64
69
  end
65
-
66
- if unity_versions.length == 1
67
- selected_unity = unity_versions.first
68
- return selected_unity[:path]
69
- end
70
-
71
- # 获取所有可用的主版本号
72
- major_versions = unity_versions.map { |v|
73
- v[:version].split('.')[0..1].join('.')
74
- }.uniq.sort_by { |v| Gem::Version.new(v) }
75
-
76
- if change_unity_version
77
- # 让用户选择主版本号
78
- puts "\n可用的Unity主版本:"
79
- major_versions.each_with_index do |v, i|
80
- puts "#{i + 1}. #{v}"
81
- end
82
-
83
- print "\n请选择Unity主版本 (1-#{major_versions.length}): "
84
- choice = gets.chomp.to_i
85
-
86
- if choice < 1 || choice > major_versions.length
87
- raise Informative, "无效的选择"
88
- end
89
-
90
- selected_major_version = major_versions[choice - 1]
91
-
92
- # 保存选择的主版本号
93
- config = Pindo::PindoUserLocalConfig.instance
94
- config.unity_version = selected_major_version
95
- config.save
96
-
97
- # 在选定主版本下选择最新的版本
98
- matching_versions = unity_versions.select { |v| v[:version].start_with?(selected_major_version) }
99
- selected_unity = matching_versions.sort_by { |v| Gem::Version.new(v[:version]) }.last
100
-
101
- return selected_unity[:path]
102
- end
103
70
 
104
- # 使用已保存的版本
105
- config = Pindo::PindoUserLocalConfig.instance
106
- saved_version = config.unity_version
107
-
108
- if saved_version
109
- matching_versions = unity_versions.select { |v| v[:version].start_with?(saved_version) }
110
- if matching_versions.any?
111
- selected_unity = matching_versions.sort_by { |v| Gem::Version.new(v[:version]) }.last
112
- return selected_unity[:path]
71
+ unity_versions.sort_by! { |v| v[:major_version] }
72
+ select_unity_versions = unity_versions.select! { |v| v[:major_version] == unity_major_version } if unity_major_version
73
+ if select_unity_versions.empty?
74
+ if force_change_version
75
+ return unity_versions.last[:path]
76
+ else
77
+ raise Informative, "未找到匹配的Unity版本"
78
+ return nil
113
79
  end
80
+ else
81
+ return select_unity_versions.first[:path]
114
82
  end
115
-
116
- # 如果没有保存的版本或找不到匹配版本,让用户选择
117
- puts "\n可用的Unity主版本:"
118
- major_versions.each_with_index do |v, i|
119
- puts "#{i + 1}. #{v}"
120
- end
121
-
122
- print "\n请选择Unity主版本 (1-#{major_versions.length}): "
123
- choice = gets.chomp.to_i
124
-
125
- if choice < 1 || choice > major_versions.length
126
- raise Informative, "无效的选择"
127
- end
128
-
129
- selected_major_version = major_versions[choice - 1]
130
-
131
- # 保存选择的主版本号
132
- config.unity_version = selected_major_version
133
- config.save
134
-
135
- # 在选定主版本下选择最新的版本
136
- matching_versions = unity_versions.select { |v| v[:version].start_with?(selected_major_version) }
137
- selected_unity = matching_versions.sort_by { |v| Gem::Version.new(v[:version]) }.last
138
-
139
- selected_unity[:path]
83
+
140
84
  end
141
85
 
142
86
  private
@@ -153,17 +97,19 @@ module Pindo
153
97
 
154
98
  public
155
99
 
156
- def execute_unity_command(project_path, method_name, additional_args = {})
157
- unity_path = find_unity_path
100
+ def execute_unity_command(unity_exe_full_path, project_path, additional_args = {})
101
+ if unity_exe_full_path.nil?
102
+ raise Informative, "Unity path not found!"
103
+ end
158
104
 
159
105
  cmd_args = [
160
- unity_path,
106
+ unity_exe_full_path,
161
107
  "-batchmode",
162
108
  "-quit",
163
109
  "-projectPath",
164
110
  project_path.to_s,
165
111
  "-executeMethod",
166
- method_name
112
+ "GoodUnityBuild.BuildManager.BatchBuild"
167
113
  ]
168
114
 
169
115
  # Add any additional arguments
@@ -179,17 +125,17 @@ module Pindo
179
125
  success: status.success?,
180
126
  stdout: stdout,
181
127
  stderr: stderr,
182
- exit_status: status.exitstatus,
183
- unity_version: extract_version_from_path(unity_path)
128
+ exit_status: status.exitstatus
184
129
  }
185
130
  end
186
131
 
187
- def build_project(project_path, build_method, platform: nil, output_path: nil)
188
- additional_args = {}
189
- additional_args[:buildTarget] = platform if platform
190
- additional_args[:outputPath] = output_path if output_path
132
+
133
+ def build_project(unity_exe_full_path:nil, project_path:nil, platform: nil, isLibrary: false)
191
134
 
192
- result = execute_unity_command(project_path, build_method, additional_args)
135
+ additional_args = {}
136
+ additional_args[:platform] = platform if platform
137
+ additional_args[:buildtype] = 'library' if isLibrary
138
+ result = execute_unity_command(unity_exe_full_path, project_path, additional_args)
193
139
 
194
140
  if result[:success]
195
141
  puts "Unity build completed successfully"
@@ -205,14 +151,6 @@ module Pindo
205
151
  result
206
152
  end
207
153
 
208
- def get_project_settings(project_path)
209
- settings_path = File.join(project_path, "ProjectSettings", "ProjectSettings.asset")
210
- if File.exist?(settings_path)
211
- File.read(settings_path)
212
- else
213
- raise "Project settings file not found at #{settings_path}"
214
- end
215
- end
216
154
 
217
155
  def get_unity_version(project_path)
218
156
  version_path = File.join(project_path, "ProjectSettings", "ProjectVersion.txt")
@@ -232,17 +170,6 @@ module Pindo
232
170
  end
233
171
  end
234
172
 
235
- def verify_unity_version(project_path)
236
- project_version = get_unity_version(project_path)
237
- unity_path = find_unity_path
238
- editor_version = extract_version_from_path(unity_path)
239
-
240
- if project_version != editor_version
241
- raise "Project Unity version (#{project_version}) does not match Editor version (#{editor_version})"
242
- end
243
-
244
- true
245
- end
246
173
 
247
174
  def unity_project?(project_path)
248
175
  # 检查关键Unity工程文件和目录是否存在
data/lib/pindo/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Pindo
2
2
 
3
- VERSION = "4.9.2"
3
+ VERSION = "4.9.4"
4
4
 
5
5
  class VersionCheck
6
6