pindo 4.8.2 → 4.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pindo/command/deploy/build.rb +22 -1
- data/lib/pindo/command/deploy/cert.rb +24 -13
- data/lib/pindo/command/deploy/configproj.rb +3 -2
- data/lib/pindo/command/dev/debug.rb +7 -0
- data/lib/pindo/config/pindouserlocalconfig.rb +35 -1
- data/lib/pindo/module/appstore/appstore_in_app_purchase.rb +10 -8
- data/lib/pindo/module/appstore/appstore_metadata_fastlane_helper.rb +185 -92
- data/lib/pindo/module/cert/certhelper.rb +40 -16
- data/lib/pindo/module/cert/xcodecerthelper.rb +50 -22
- data/lib/pindo/module/pgyer/pgyerhelper.rb +34 -6
- data/lib/pindo/module/xcode/xcodeappconfig.rb +27 -3
- data/lib/pindo/module/xcode/xcodebuildhelper.rb +15 -5
- data/lib/pindo/module/xcode/xcoderesconstant.rb +169 -116
- data/lib/pindo/module/xcode/xcodereshandler.rb +78 -93
- data/lib/pindo/module/xcode/xcodereshelper.rb +2 -2
- data/lib/pindo/options/deployoptions.rb +9 -0
- data/lib/pindo/version.rb +1 -1
- metadata +3 -3
@@ -8,77 +8,18 @@ module Pindo
|
|
8
8
|
class XcodeResHandler
|
9
9
|
|
10
10
|
|
11
|
-
def self.create_icon(icon_name:nil, new_icon_dir:nil, xcode_icon_json:nil)
|
12
|
-
xcode_icon_json["images"].each do |image_data|
|
13
|
-
width,height = image_data["size"].split("x")
|
14
|
-
image_name = image_data["filename"]
|
15
|
-
iNum = image_name.split("@").last.chomp(".png").chomp("x").to_f
|
16
|
-
width = width.to_f * iNum
|
17
|
-
height = height.to_f * iNum
|
18
|
-
|
19
|
-
width = width.to_i
|
20
|
-
height = height.to_i
|
21
|
-
|
22
|
-
command = [
|
23
|
-
'sips',
|
24
|
-
'--matchTo', '/System/Library/ColorSync/Profiles/sRGB Profile.icc',
|
25
|
-
'-z', width.to_s, height.to_s,
|
26
|
-
icon_name,
|
27
|
-
'--out', File.join(new_icon_dir, image_name)
|
28
|
-
]
|
29
|
-
Executable.capture_command('sips', command, capture: :out)
|
30
|
-
|
31
|
-
# if !File.exist?(File.join(new_icon_dir, image_name))
|
32
|
-
# raise Informative, "生成icon失败!"
|
33
|
-
# end
|
34
|
-
# system("sips --matchTo '/System/Library/ColorSync/Profiles/sRGB Profile.icc' -z #{width} #{height} #{icon_name} --out #{new_icon_dir}/#{image_name}")
|
35
|
-
end
|
36
|
-
File.open(File.join(new_icon_dir, "Contents.json"), "w") do |f|
|
37
|
-
f.write(JSON.pretty_generate(xcode_icon_json))
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
def self.create_imessage_icon(icon_name:nil, image_icon_name:nil, new_icon_dir:nil, xcode_icon_json:nil)
|
43
|
-
xcode_icon_json["images"].each do |image_data|
|
44
|
-
|
45
|
-
height, width = image_data["size"].split("x")
|
46
|
-
image_name = image_data["filename"]
|
47
|
-
iNum = image_name.split("@").last.chomp(".png").chomp("x").to_f
|
48
|
-
width = width.to_f * iNum
|
49
|
-
height = height.to_f * iNum
|
50
|
-
width = width.to_i
|
51
|
-
height = height.to_i
|
52
|
-
|
53
|
-
icon_ori_name = image_icon_name
|
54
|
-
if width.to_s.eql?(height.to_s)
|
55
|
-
icon_ori_name = icon_name
|
56
|
-
end
|
57
|
-
|
58
|
-
command = [
|
59
|
-
'sips',
|
60
|
-
'--matchTo', '/System/Library/ColorSync/Profiles/sRGB Profile.icc',
|
61
|
-
'-z', width.to_s, height.to_s,
|
62
|
-
icon_name,
|
63
|
-
'--out', File.join(new_icon_dir, image_name)
|
64
|
-
]
|
65
|
-
Executable.capture_command('sips', command, capture: :out)
|
66
|
-
end
|
67
|
-
|
68
|
-
File.open(File.join(new_icon_dir, "Contents.json"), "w") do |f|
|
69
|
-
f.write(JSON.pretty_generate(xcode_icon_json))
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
11
|
def initialize(proj_fullname:nil)
|
74
12
|
@proj_fullname = proj_fullname
|
75
13
|
@project_obj = Xcodeproj::Project.open(proj_fullname)
|
76
14
|
end
|
77
15
|
|
78
|
-
def get_xcodeproj_icon_path
|
16
|
+
def get_xcodeproj_icon_path()
|
79
17
|
|
80
18
|
icon_path = nil
|
81
19
|
select_target = @project_obj.targets.select { |target| target.product_type.include?(Xcodeproj::Constants::PRODUCT_TYPE_UTI[:application]) }.first
|
20
|
+
|
21
|
+
project_dir = @project_obj.project_dir
|
22
|
+
|
82
23
|
if !select_target.nil?
|
83
24
|
file_refs = select_target.resources_build_phase.files_references.select { |file| file.display_name.include?("Assets.xcassets") } || []
|
84
25
|
file_refs.each do |file_ref|
|
@@ -90,6 +31,14 @@ module Pindo
|
|
90
31
|
end
|
91
32
|
end
|
92
33
|
end
|
34
|
+
if icon_path.nil? || icon_path.empty? || !File.exist?(icon_path)
|
35
|
+
icon_path_array = Dir.glob(File.join(project_dir, "**", "AppIcon.appiconset"))
|
36
|
+
if icon_path_array.size > 1
|
37
|
+
icon_path = icon_path_array.select{ |filename| File.directory?(filename) && filename.include?("Assets.xcassets/AppIcon.appiconset")}
|
38
|
+
elsif icon_path_array.size == 1
|
39
|
+
icon_path = icon_path_array.first
|
40
|
+
end
|
41
|
+
end
|
93
42
|
|
94
43
|
if icon_path.nil? || icon_path.empty? || !File.exist?(icon_path)
|
95
44
|
raise Informative, "没有找到Xcode icon 目录"
|
@@ -99,7 +48,7 @@ module Pindo
|
|
99
48
|
end
|
100
49
|
|
101
50
|
def install_icon_res(new_icon_dir:nil)
|
102
|
-
icon_path = get_xcodeproj_icon_path
|
51
|
+
icon_path = get_xcodeproj_icon_path()
|
103
52
|
begin
|
104
53
|
FileUtils.rm_rf(icon_path)
|
105
54
|
FileUtils.mkdir_p(icon_path)
|
@@ -112,7 +61,7 @@ module Pindo
|
|
112
61
|
end
|
113
62
|
|
114
63
|
def validate_icon_res()
|
115
|
-
icon_path = get_xcodeproj_icon_path
|
64
|
+
icon_path = get_xcodeproj_icon_path()
|
116
65
|
xcode_ios_icon_json = XcodoeResConst.xcode_ios_icon_json
|
117
66
|
xcode_ios_icon_json["images"].each do |image_data|
|
118
67
|
image_name = image_data["filename"]
|
@@ -125,6 +74,7 @@ module Pindo
|
|
125
74
|
def get_xcodeproj_imessage_icon_path
|
126
75
|
icon_path = nil
|
127
76
|
select_target = @project_obj.targets.select { |target| target.product_type.include?(Xcodeproj::Constants::PRODUCT_TYPE_UTI[:messages_extension]) }.first
|
77
|
+
project_dir = @project_obj.project_dir
|
128
78
|
if !select_target.nil?
|
129
79
|
file_refs = select_target.resources_build_phase.files_references.select { |file| file.display_name.include?("Assets.xcassets") } || []
|
130
80
|
file_refs.each do |file_ref|
|
@@ -136,6 +86,15 @@ module Pindo
|
|
136
86
|
end
|
137
87
|
end
|
138
88
|
|
89
|
+
if icon_path.nil? || icon_path.empty? || !File.exist?(icon_path)
|
90
|
+
icon_path_array = Dir.glob(File.join(project_dir, "**", "iMessage App Icon.stickersiconset"))
|
91
|
+
if icon_path_array.size > 1
|
92
|
+
icon_path = icon_path_array.select{ |filename| File.directory?(filename) && filename.include?("Assets.xcassets/iMessage App Icon.stickersiconset")}
|
93
|
+
elsif icon_path_array.size == 1
|
94
|
+
icon_path = icon_path_array.first
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
139
98
|
if icon_path.nil? || icon_path.empty? || !File.exist?(icon_path)
|
140
99
|
raise Informative, "没有找到Xcode iMessage icon 目录"
|
141
100
|
end
|
@@ -173,50 +132,76 @@ module Pindo
|
|
173
132
|
def get_xcodeproj_launchimg_path
|
174
133
|
|
175
134
|
launchimg_path = nil
|
135
|
+
assets_path = nil
|
176
136
|
select_target = @project_obj.targets.select { |target| target.product_type.include?(Xcodeproj::Constants::PRODUCT_TYPE_UTI[:application]) }.first
|
177
|
-
|
137
|
+
project_dir = @project_obj.project_dir
|
138
|
+
if !select_target.nil?
|
139
|
+
assets_objs = select_target.resources_build_phase.files_references.select { |file| file.display_name.include?("Assets.xcassets") } || []
|
140
|
+
if assets_objs.size > 0
|
141
|
+
assets_path = assets_objs.first.real_path
|
142
|
+
if File.exist?(assets_path) && File.exist?(File.join(assets_path, "LaunchImage.imageset"))
|
143
|
+
launchimg_path = File.join(assets_path, "LaunchImage.imageset")
|
144
|
+
elsif File.exist?(assets_path) && File.exist?(File.join(assets_path, "LaunchImage.launchimage"))
|
145
|
+
launchimg_path = File.join(assets_path, "LaunchImage.launchimage")
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
178
149
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
150
|
+
if launchimg_path.nil? || launchimg_path.empty? || !File.exist?(launchimg_path)
|
151
|
+
launchimg_path_array = Dir.glob(File.join(project_dir, "**", "LaunchImage.imageset"))
|
152
|
+
if launchimg_path_array.size > 1
|
153
|
+
launchimg_path = launchimg_path_array.select{ |filename| File.directory?(filename) && filename.include?("Assets.xcassets/LaunchImage.imageset")}
|
154
|
+
elsif launchimg_path_array.size == 1
|
155
|
+
launchimg_path = launchimg_path_array.first
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
if launchimg_path.nil? || launchimg_path.empty? || !File.exist?(launchimg_path)
|
160
|
+
launchimg_path_array = Dir.glob(File.join(project_dir, "**", "LaunchImage.launchimage"))
|
161
|
+
if launchimg_path_array.size > 1
|
162
|
+
launchimg_path = launchimg_path_array.select{ |filename| File.directory?(filename) && filename.include?("Assets.xcassets/LaunchImage.launchimage")}
|
163
|
+
elsif launchimg_path_array.size == 1
|
164
|
+
launchimg_path = launchimg_path_array.first
|
165
|
+
end
|
184
166
|
end
|
185
167
|
|
186
168
|
return launchimg_path
|
187
169
|
end
|
188
170
|
|
189
|
-
def install_launchimg(
|
190
|
-
|
171
|
+
def install_launchimg(launchimg_pub_path:nil)
|
191
172
|
|
192
173
|
xcodeproj_launchimg_path = get_xcodeproj_launchimg_path
|
193
|
-
|
194
|
-
return
|
195
|
-
end
|
196
|
-
|
197
|
-
project_origin_launchimg = Dir.glob(File.join(xcodeproj_launchimg_path, "/*.png")).max_by {|f| File.mtime(f)}
|
174
|
+
pub_launchimg_files = Dir.glob(File.join(launchimg_pub_path, "*.{png,jpg}"))
|
198
175
|
|
199
|
-
if
|
176
|
+
if xcodeproj_launchimg_path.nil? || !File.exist?(xcodeproj_launchimg_path)
|
177
|
+
if !pub_launchimg_files.nil? && pub_launchimg_files.size > 0
|
178
|
+
raise Informative, "有需要替换的资源,但是未找到工程启动图目录,替换启动图失败!"
|
179
|
+
end
|
200
180
|
return
|
201
181
|
end
|
202
182
|
|
203
|
-
if
|
204
|
-
|
205
|
-
end
|
183
|
+
# if pub_launchimg_files.nil? || pub_launchimg_files.size == 0
|
184
|
+
# raise Informative, "有需要替换的资源,但是配置中未放置替换的启动图!"
|
185
|
+
# end
|
206
186
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
rescue StandardError => e
|
187
|
+
xcodeproj_launchimg_json_file = File.join(xcodeproj_launchimg_path, "Contents.json")
|
188
|
+
if !File.exist?(xcodeproj_launchimg_json_file)
|
189
|
+
raise Informative, "工程启动图目录缺少Contents.json,替换启动图失败!"
|
211
190
|
end
|
212
191
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
192
|
+
xcodeproj_launchimg_json = JSON.parse(File.read(xcodeproj_launchimg_json_file))
|
193
|
+
image_array = xcodeproj_launchimg_json["images"].select { |image| !image["filename"].nil? && !image["filename"].empty? }
|
194
|
+
|
195
|
+
if pub_launchimg_files.size == image_array.size
|
196
|
+
if image_array.size == 1
|
197
|
+
launchimg_filename = image_array.first["filename"]
|
198
|
+
launchimg_full_filename = File.join(xcodeproj_launchimg_path, launchimg_filename)
|
199
|
+
FileUtils.cp(pub_launchimg_files.first, launchimg_full_filename)
|
200
|
+
else
|
201
|
+
raise Informative, "启动图有多张,替换异常,遇到这种情况再处理!"
|
202
|
+
end
|
203
|
+
else
|
204
|
+
raise Informative, "工程中启动图数目和配置仓库的图片数目不一致"
|
220
205
|
end
|
221
206
|
|
222
207
|
end
|
@@ -108,10 +108,10 @@ module Pindo
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
-
def self.install_launchimg(proj_dir:nil,
|
111
|
+
def self.install_launchimg(proj_dir:nil, launchimg_pub_path:nil)
|
112
112
|
xcodeproj_file_name = Dir.glob(File.join(proj_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
|
113
113
|
xcodereshandler = XcodeResHandler.new(proj_fullname: xcodeproj_file_name)
|
114
|
-
xcodereshandler.install_launchimg(
|
114
|
+
xcodereshandler.install_launchimg(launchimg_pub_path:launchimg_pub_path)
|
115
115
|
end
|
116
116
|
|
117
117
|
end
|
@@ -53,6 +53,7 @@ module Pindo
|
|
53
53
|
attr_accessor :args_dev_flag
|
54
54
|
attr_accessor :args_adhoc_flag
|
55
55
|
attr_accessor :args_appstore_flag
|
56
|
+
attr_accessor :args_macos_flag
|
56
57
|
|
57
58
|
attr_accessor :newconfuse_flag
|
58
59
|
attr_accessor :oldconfuse_flag
|
@@ -69,6 +70,7 @@ module Pindo
|
|
69
70
|
['--dev', 'use dev build mode'],
|
70
71
|
['--adhoc', 'use adhoc build mode'],
|
71
72
|
['--appstore', 'use appstore build mode'],
|
73
|
+
['--macos', 'use platform macos'],
|
72
74
|
|
73
75
|
['--nocreate', 'no create xcode project'],
|
74
76
|
|
@@ -92,6 +94,7 @@ module Pindo
|
|
92
94
|
@args_dev_flag = argv.flag?('dev', false)
|
93
95
|
@args_adhoc_flag = argv.flag?('adhoc', false)
|
94
96
|
@args_appstore_flag = argv.flag?('appstore', false)
|
97
|
+
@args_macos_flag = argv.flag?('macos', false)
|
95
98
|
|
96
99
|
@newconfuse_flag = argv.flag?('newconfuse', true)
|
97
100
|
@oldconfuse_flag = argv.flag?('oldconfuse', false)
|
@@ -142,6 +145,11 @@ module Pindo
|
|
142
145
|
mode_flag = "--appstore"
|
143
146
|
end
|
144
147
|
args_temp << mode_flag
|
148
|
+
|
149
|
+
if @args_macos_flag
|
150
|
+
args_temp << "--macos"
|
151
|
+
end
|
152
|
+
return args_temp
|
145
153
|
end
|
146
154
|
|
147
155
|
def get_confuse_type_args()
|
@@ -348,6 +356,7 @@ module Pindo
|
|
348
356
|
puts "args_dev_flag = #{@args_dev_flag}"
|
349
357
|
puts "args_adhoc_flag = #{@args_adhoc_flag}"
|
350
358
|
puts "args_appstore_flag = #{@args_appstore_flag}"
|
359
|
+
puts "args_macos_flag = #{@args_macos_flag}"
|
351
360
|
|
352
361
|
puts "\n***************************************************************************************"
|
353
362
|
puts "=======================================================================================\n\n"
|
data/lib/pindo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pindo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.8.
|
4
|
+
version: 4.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- wade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: claide
|
@@ -365,7 +365,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
365
365
|
- !ruby/object:Gem::Version
|
366
366
|
version: '0'
|
367
367
|
requirements: []
|
368
|
-
rubygems_version: 3.
|
368
|
+
rubygems_version: 3.5.23
|
369
369
|
signing_key:
|
370
370
|
specification_version: 3
|
371
371
|
summary: easy work
|