fastlane-plugin-ipa_info 0.3.1 → 0.6.0

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
- SHA1:
3
- metadata.gz: a0b9a188a3b7f15d5fc328e08123485a6a5dcc6d
4
- data.tar.gz: b64446440b7c70554c0f05606b24f4257e50f22c
2
+ SHA256:
3
+ metadata.gz: 477ddb7083b35228565294f91a6663f8a28bb6be9c12d9c388385e09479a78c3
4
+ data.tar.gz: 30c246417a944bf11deaad3bf1154822179cd4cb7a4499ce4bad037c412d5d9e
5
5
  SHA512:
6
- metadata.gz: dcf7e27fb1e1c55261bbdee8a640c14db453ea3891a467edbcb50af1e72c0c2dc339f2a13f0401c94f9eba486a3d292db7a642625e2339b000713b429924d2cf
7
- data.tar.gz: 53a6d26be4ed53d34a2da58ac43256c0d6ac831ee551993035a79f2a27ce73ef5978f4d99f249aa829656d9ddd9e8f6de47801554d0e2818e2b6bed7244e8527
6
+ metadata.gz: decf9c25b01271d3dd0f5908c4f11f3ab3443dcd82c93a523291916b77de18f94790d616471e579962bd59949d5e52852040de6b91510a44eaba56e35f532050
7
+ data.tar.gz: 2598004e5d4c87742065854f45a0848599f632449e616453601c8b7a97d192fc116401a75c3dfeed25fabe2b1c0f931223e16e934439fc5b602773a3a7074ead
@@ -1,4 +1,3 @@
1
- require 'ipa_analyzer'
2
1
  require 'json'
3
2
 
4
3
  module Fastlane
@@ -8,30 +7,28 @@ module Fastlane
8
7
  @file = params[:ipa_file]
9
8
  UI.user_error!('You have to set path an ipa file') unless @file
10
9
 
11
- begin
12
- ipa_info = IpaAnalyzer::Analyzer.new(@file)
13
- ipa_info.open!
14
- ipa_info_result = ipa_info.collect_info_plist_info[:content]
15
- provision_info_result = ipa_info.collect_provision_info[:content]
16
- ipa_info.close
17
- rescue e
18
- UI.user_error!(e.message)
19
- end
10
+ # result
11
+ info_result = Helper::IpaAnalyzeHelper.analyze(@file)
20
12
 
21
13
  # show build environment info
22
- rows = Helper::IpaInfoHelper.build_environment_information(ipa_info_result: ipa_info_result)
14
+ rows = Helper::IpaInfoHelper.build_environment_information(ipa_info_result: info_result[:plist_info])
23
15
  summary_table = Helper::IpaInfoHelper.summary_table(title: "Build Environment", rows: rows)
24
16
  puts(summary_table)
25
17
 
26
18
  # show ipa info
27
- rows = Helper::IpaInfoHelper.ipa_information(ipa_info_result: ipa_info_result)
19
+ rows = Helper::IpaInfoHelper.ipa_information(ipa_info_result: info_result[:plist_info])
28
20
  summary_table = Helper::IpaInfoHelper.summary_table(title: "ipa Information", rows: rows)
29
21
  puts(summary_table)
30
22
 
31
- # certificate info
32
- rows = Helper::IpaInfoHelper.certificate_information(provision_info_result: provision_info_result)
23
+ # mobile provisioning info
24
+ rows = Helper::IpaInfoHelper.mobileprovisioning_information(provision_info_result: info_result[:provisiong_info])
33
25
  summary_table = Helper::IpaInfoHelper.summary_table(title: "Mobile Provision", rows: rows)
34
26
  puts(summary_table)
27
+
28
+ # certificate info
29
+ rows = Helper::IpaInfoHelper.certificate_information(certificate_info_result: info_result[:certificate_info])
30
+ summary_table = Helper::IpaInfoHelper.summary_table(title: "Certificate", rows: rows)
31
+ puts(summary_table)
35
32
  end
36
33
 
37
34
  def self.description
@@ -0,0 +1,111 @@
1
+ require 'tempfile'
2
+ require 'tmpdir'
3
+ require 'zip'
4
+ require 'zip/filesystem'
5
+ require 'fileutils'
6
+ require 'plist'
7
+ require 'open3'
8
+ require 'fastlane_core/ui/ui'
9
+
10
+ module Fastlane
11
+ module Helper
12
+ class IpaAnalyzeHelper
13
+ def self.analyze(ipa_path)
14
+ ipa_zipfile = Zip::File.open(ipa_path)
15
+ app_folder_path = find_app_folder_path_in_ipa(ipa_path)
16
+ ipa_zipfile.close
17
+
18
+ # file path
19
+ mobileprovision_entry = ipa_zipfile.find_entry("#{app_folder_path}/embedded.mobileprovision")
20
+ UI.user_error!("mobileprovision not found in #{ipa_path}") unless mobileprovision_entry
21
+ info_plist_entry = ipa_zipfile.find_entry("#{app_folder_path}/Info.plist")
22
+ UI.user_error!("Info.plist not found in #{ipa_path}") unless info_plist_entry
23
+
24
+ return {
25
+ provisiong_info: self.analyze_mobileprovisioning(mobileprovision_entry, ipa_zipfile),
26
+ plist_info: self.analyze_info_plist(info_plist_entry, ipa_zipfile),
27
+ certificate_info: self.codesigned(ipa_zipfile)
28
+ }
29
+ end
30
+
31
+ # Info plist
32
+ def self.analyze_info_plist(info_plist_entry, ipa_zipfile)
33
+ result = {}
34
+
35
+ tempfile = Tempfile.new(::File.basename(info_plist_entry.name))
36
+ begin
37
+ ipa_zipfile.extract(info_plist_entry, tempfile.path) { true }
38
+ UI.user_error!("Failed to convert binary Plist to XML") unless system("plutil -convert xml1 '#{tempfile.path}'")
39
+
40
+ plist = Plist.parse_xml(tempfile.path)
41
+
42
+ plist.each do |key, value|
43
+ parse_value = value.class == Hash || value.class == Array ? value : value.to_s
44
+
45
+ result[key] = parse_value
46
+ end
47
+ rescue StandardError => e
48
+ UI.user_error!(e.message)
49
+ ensure
50
+ tempfile.close && tempfile.unlink
51
+ end
52
+ return result
53
+ end
54
+
55
+ # mobileprovisioning
56
+ def self.analyze_mobileprovisioning(mobileprovision_entry, ipa_zipfile)
57
+ result = {}
58
+
59
+ tempfile = Tempfile.new(::File.basename(mobileprovision_entry.name))
60
+ begin
61
+ ipa_zipfile.extract(mobileprovision_entry, tempfile.path) { true }
62
+ mobileprovisioning = Plist.parse_xml(`security cms -D -i #{tempfile.path}`)
63
+
64
+ mobileprovisioning.each do |key, value|
65
+ next if key == 'DeveloperCertificates'
66
+
67
+ parse_value = value.class == Hash || value.class == Array ? value : value.to_s
68
+
69
+ result[key] = parse_value
70
+ end
71
+ rescue StandardError => e
72
+ UI.user_error!(e.message)
73
+ ensure
74
+ tempfile.close && tempfile.unlink
75
+ end
76
+ return result
77
+ end
78
+
79
+ # certificate
80
+ def self.codesigned(ipa_zipfile)
81
+ result = {}
82
+ tempdir = Dir.pwd + "/tmp"
83
+
84
+ begin
85
+ ipa_zipfile.each do |entry_first|
86
+ entry_first.extract(tempdir + "/" + entry_first.name) { true }
87
+ end
88
+
89
+ app_path = tempdir + "/Payload/ios.app"
90
+ cmd = "codesign -dv #{app_path}"
91
+ _stdout, stderr, _status = Open3.capture3(cmd)
92
+ codesigned_flag = stderr.include?("Signed Time")
93
+
94
+ result["CodeSigned"] = codesigned_flag
95
+ rescue StandardError => e
96
+ UI.user_error!(e.message)
97
+ ensure
98
+ FileUtils.rm_r(tempdir)
99
+ end
100
+ return result
101
+ end
102
+
103
+ # return app folder path
104
+ def self.find_app_folder_path_in_ipa(ipa_path)
105
+ return "Payload/#{File.basename(ipa_path, File.extname(ipa_path))}.app"
106
+ end
107
+
108
+ private_class_method :find_app_folder_path_in_ipa
109
+ end
110
+ end
111
+ end
@@ -8,12 +8,14 @@ module Fastlane
8
8
  rows = []
9
9
  [%w[DTXcode Xcode],
10
10
  %w[DTXcodeBuild XcodeBuild]].each do |key, name|
11
+ ENV["FL_#{name.upcase}"] = ipa_info_result[key]
11
12
  rows << [name, ipa_info_result[key]]
12
13
  end
13
14
 
14
15
  # add os name and version
15
16
  [%w[BuildMachineOSBuild MacOS]].each do |key, name|
16
17
  mac_os_build = ipa_info_result[key]
18
+
17
19
  mac_os_version = self.macos_build_to_macos_version(build: mac_os_build)
18
20
  mac_os_name = self.macos_version_to_os_name(version: mac_os_version)
19
21
  rows << [name, "#{mac_os_name} #{mac_os_version} (#{mac_os_build})"]
@@ -28,16 +30,32 @@ module Fastlane
28
30
  [%w[CFBundleName BundleName],
29
31
  %w[CFBundleShortVersionString Version],
30
32
  %w[CFBundleVersion BuildVersion]].each do |key, name|
33
+ ENV["FL_#{name.upcase}"] = ipa_info_result[key]
34
+
31
35
  rows << [name, ipa_info_result[key]]
32
36
  end
33
37
 
34
38
  rows
35
39
  end
36
40
 
37
- def self.certificate_information(provision_info_result:)
41
+ # certificate info
42
+ def self.certificate_information(certificate_info_result:)
43
+ rows = []
44
+ [%w[CodeSigned CodeSigned]].each do |key, name|
45
+ ENV["FL_#{name.upcase}"] = certificate_info_result[key].to_s
46
+
47
+ rows << [name, certificate_info_result[key].to_s]
48
+ end
49
+
50
+ rows
51
+ end
52
+
53
+ # mobileprovisioning info
54
+ def self.mobileprovisioning_information(provision_info_result:)
38
55
  rows = []
39
56
  [%w[TeamName TeamName],
40
57
  %w[Name ProvisioningProfileName]].each do |key, name|
58
+ ENV["FL_#{name.upcase}"] = provision_info_result[key]
41
59
  rows << [name, provision_info_result[key]]
42
60
  end
43
61
 
@@ -47,6 +65,9 @@ module Fastlane
47
65
  expire_date = Date.parse(provision_info_result[key].to_s)
48
66
  count_day = (expire_date - today).numerator
49
67
 
68
+ ENV["FL_#{name.upcase}"] = provision_info_result[key]
69
+ ENV["FL_COUNT_DAY"] = count_day.to_s
70
+
50
71
  rows << [name, provision_info_result[key]]
51
72
  rows << ["DeadLine", "#{count_day} day"]
52
73
  end
@@ -55,16 +76,50 @@ module Fastlane
55
76
  end
56
77
 
57
78
  # macOS build number to macOS version
58
- # @return macOS version(Sierra, High Sierra only)
79
+ # @return macOS version(High Sierra or higher)
59
80
  def self.macos_build_to_macos_version(build:)
60
- # reference https://support.apple.com/ja-jp/HT201260
61
81
  case build
82
+ # macOS Big Sur
83
+ when "20B29", "20B50" then
84
+ "11.0.1"
85
+ # macOS Catalina
86
+ when "19H2", "19H15" then
87
+ "10.15.7"
88
+ when "19G73", "19G2021" then
89
+ "10.15.6"
90
+ when "19F101", "19F96" then
91
+ "10.15.5"
92
+ when "19E266" then
93
+ "10.15.4"
94
+ when "19D76" then
95
+ "10.15.3"
96
+ when "19C57" then
97
+ "10.15.2"
98
+ when "19B88" then
99
+ "10.15.1"
100
+ when "19A583", "19A602", "19A603" then
101
+ "10.15"
102
+ # macOS Mojave
103
+ when "18G84", "18G103", "18G1012", "18G95" then
104
+ "10.14.6"
105
+ when "18F132", "18F203" then
106
+ "10.14.5"
107
+ when "18E226", "18E227" then
108
+ "10.14.4"
109
+ when "18D42", "18D43", "18D109" then
110
+ "10.14.3"
111
+ when "18C54" then
112
+ "10.14.2"
113
+ when "18B75", "18B2107", "18B3094" then
114
+ "10.14.1"
115
+ when "18A391" then
116
+ "10.14"
62
117
  # macOS High Sierra
63
- when "17G65" then
118
+ when "17G65", "17G6029" then
64
119
  "10.13.6"
65
120
  when "17F77" then
66
121
  "10.13.5"
67
- when "17E199", "17E201" then
122
+ when "17E199", "17E201", "17E202" then
68
123
  "10.13.4"
69
124
  when "17D47", "17D102", "17D2047", "17D2102" then
70
125
  "10.13.3"
@@ -74,30 +129,24 @@ module Fastlane
74
129
  "10.13.1"
75
130
  when "17A365", "17A405" then
76
131
  "10.13"
77
- # macOS Sierra
78
- when "16G29", "16G1036", "16G1114", "16G1212" then
79
- "10.12.6"
80
- when "16F73" then
81
- "10.12.5"
82
- when "16E195" then
83
- "10.12.4"
84
- when "16D32" then
85
- "10.12.3"
86
- when "16C67" then
87
- "10.12.2"
88
- when "16B2555", "16B2557" then
89
- "10.12.1"
90
- when "16A323" then
91
- "10.12.1"
92
132
  else
93
133
  "UnKnown"
94
134
  end
95
135
  end
96
136
 
97
137
  def self.macos_version_to_os_name(version:)
138
+ major_version = version.split(".")[0].to_i
98
139
  minor_version = version.split(".")[1].to_i
99
140
  # reference https://support.apple.com/ja-jp/HT201260
141
+ case major_version
142
+ when 11
143
+ return "macOS Big Sur"
144
+ end
100
145
  case minor_version
146
+ when 15
147
+ "macOS Catalina"
148
+ when 14
149
+ "macOS Mojave"
101
150
  when 13
102
151
  "macOS High Sierra"
103
152
  when 12
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module IpaInfo
3
- VERSION = "0.3.1"
3
+ VERSION = "0.6.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,29 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-ipa_info
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - tarappo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-22 00:00:00.000000000 Z
11
+ date: 2021-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: ipa_analyzer
14
+ name: plist
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 3.1.0
20
+ - - "~>"
21
+ - !ruby/object:Gem::Version
22
+ version: '3.1'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '0'
29
+ version: 3.1.0
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '3.1'
33
+ - !ruby/object:Gem::Dependency
34
+ name: rubyzip
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.1'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.1.7
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '1.1'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 1.1.7
27
53
  - !ruby/object:Gem::Dependency
28
54
  name: pry
29
55
  requirement: !ruby/object:Gem::Requirement
@@ -160,6 +186,7 @@ files:
160
186
  - README.md
161
187
  - lib/fastlane/plugin/ipa_info.rb
162
188
  - lib/fastlane/plugin/ipa_info/actions/ipa_info_action.rb
189
+ - lib/fastlane/plugin/ipa_info/helper/ipa_analyze_helper.rb
163
190
  - lib/fastlane/plugin/ipa_info/helper/ipa_info_helper.rb
164
191
  - lib/fastlane/plugin/ipa_info/version.rb
165
192
  homepage: https://github.com/tarappo/fastlane-plugin-ipa_info
@@ -181,8 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
208
  - !ruby/object:Gem::Version
182
209
  version: '0'
183
210
  requirements: []
184
- rubyforge_project:
185
- rubygems_version: 2.5.1
211
+ rubygems_version: 3.0.3
186
212
  signing_key:
187
213
  specification_version: 4
188
214
  summary: show ipa info