fastlane-plugin-verify_ipa 0.2.1 → 0.4.1

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
  SHA1:
3
- metadata.gz: 7df2773b96bdafbbf9d8e504fd7d2f6f0ef60751
4
- data.tar.gz: 5fad2cf9c96f8640497603dfc7b15b80c5a4c483
3
+ metadata.gz: a8d3d6a12c11ed740135f189e5ee1bbd27f4e155
4
+ data.tar.gz: 5f225411dfcd0b22c1651b1bea94b903b84bab57
5
5
  SHA512:
6
- metadata.gz: d30ee60af2cda4cee684308beec4ab411eeeb1bb7afdb7a95cc92a429daa75c92e1d99e003a9f461302458b70ca0f017fdd399b254a6625bacdf5abc5bf72425
7
- data.tar.gz: 955cce05513b544ee7aa39bd7464e470b764c2fd0161951cd26a2599a5957d7abc47405a3030f677837130b28b77c16bb2c5e7bb951bbf805ac42f57c4194f6f
6
+ metadata.gz: afd584e1c65d24a7297ec756ba095056a96ca6a287ca9fb46aa6279a473788f1a1adbb43f9516adb39501a76abd1f2c5f29ecc1113668cb31ced179a174a4b12
7
+ data.tar.gz: d66f57bffaf9c67957e54b12985172411b14979733da809a19aa9c3ddc427b0c58d8c84bca6ed0ffc71060b8c998c448f3a8c6870f0f9c7e578275da6e7b6a3b
data/README.md CHANGED
@@ -62,9 +62,32 @@ verify_ipa_entitlements(
62
62
  team_identifier: 'MZ6ZTY3EA7',
63
63
  aps_environment: 'production',
64
64
  other_params: {
65
- keychain_access_groups: ['MZ6ZTY3EA7.*'],
66
- get_task_allow: false
67
- }
65
+ keychain_access_groups: ['MZ6ZTY3EA7.*'],
66
+ get_task_allow: false,
67
+ beta_reports_active: true
68
+ }
69
+ )
70
+ ```
71
+
72
+ To test application extensions, use the `:extensions` parameter, e.g:
73
+
74
+ ```bash
75
+ verify_ipa_entitlements(
76
+ application_identifier: 'MZ6ZTY3EA7.com.apple.myapp',
77
+ team_identifier: 'MZ6ZTY3EA7',
78
+ aps_environment: 'production',
79
+ application_groups: [
80
+ 'group.com.apple.mygroup'
81
+ ]
82
+ extensions: {
83
+ 'My Great Extension': {
84
+ application_identifier: 'MZ6ZTY3EA7.com.apple.myapp.ext',
85
+ team_identifier: 'MZ6ZTY3EA7',
86
+ application_groups: [
87
+ 'group.com.apple.mygroup'
88
+ ]
89
+ }
90
+ }
68
91
  )
69
92
  ```
70
93
 
@@ -5,42 +5,57 @@ module Fastlane
5
5
  class VerifyIpaEntitlementsAction < Action
6
6
  def self.run(params)
7
7
  Dir.mktmpdir do |dir|
8
- app_path = Helper::VerifyIpaHelper.app_path(params, dir)
8
+ app_path = Helper::VerifyIpaHelper.app_path(params[:ipa_path], dir)
9
9
  entitlements = self.read_entitlements(params, app_path)
10
10
  self.verify_entitlements(params, entitlements)
11
+ self.verify_extensions(params, app_path)
11
12
  end
12
13
  end
13
14
 
14
- def self.read_entitlements(params, app_path)
15
- profile_path = "#{app_path}/embedded.mobileprovision"
16
- profile_plist = sh("security cms -D -i #{profile_path}")
15
+ def self.read_entitlements(params, path)
16
+ profile_path = "#{path}/embedded.mobileprovision"
17
+ profile_plist = sh("security cms -D -i '#{profile_path}'")
17
18
  UI.user_error!("Unable to extract profile") unless $? == 0
18
19
 
19
20
  profile = Plist.parse_xml(profile_plist)
20
21
  profile['Entitlements']
21
22
  end
22
23
 
23
- def self.verify_entitlements(params, entitlements)
24
+ def self.verify_entitlements(params, entitlements, appex_name = nil)
24
25
  if params[:application_identifier]
25
- self.verify_param(:application_identifier, params[:application_identifier], entitlements['application-identifier'])
26
+ self.verify_param(:application_identifier, params[:application_identifier], entitlements['application-identifier'], appex_name)
26
27
  end
27
28
  if params[:team_identifier]
28
- self.verify_param(:team_identifier, params[:team_identifier], entitlements['com.apple.developer.team-identifier'])
29
+ self.verify_param(:team_identifier, params[:team_identifier], entitlements['com.apple.developer.team-identifier'], appex_name)
29
30
  end
30
31
  if params[:aps_environment]
31
- self.verify_param(:aps_environment, params[:aps_environment], entitlements['aps-environment'])
32
+ self.verify_param(:aps_environment, params[:aps_environment], entitlements['aps-environment'], appex_name)
33
+ end
34
+ if params[:application_groups]
35
+ self.verify_param(:application_groups, params[:application_groups], entitlements['com.apple.security.application-groups'], appex_name)
32
36
  end
33
37
  if params[:other_params]
34
38
  params[:other_params].keys.each do |key|
35
- self.verify_param(key, params[:other_params][key], entitlements[key.to_s.tr('_', '-')])
39
+ self.verify_param(key, params[:other_params][key], entitlements[key.to_s.tr('_', '-')], appex_name)
36
40
  end
37
41
  end
38
42
 
39
43
  UI.success("Entitlements are verified.")
40
44
  end
41
45
 
42
- def self.verify_param(param, expected, actual)
43
- UI.user_error!("Mismatched #{param}. Expected: '#{expected}'; Found: '#{actual}'") unless expected == actual
46
+ def self.verify_param(param, expected, actual, appex_name)
47
+ msg_prefix = appex_name ? "[#{appex_name}] " : ""
48
+ UI.user_error!("#{msg_prefix}Mismatched #{param}. Expected: '#{expected}'; Found: '#{actual}'") unless expected == actual
49
+ end
50
+
51
+ def self.verify_extensions(params, app_path)
52
+ if params[:extensions]
53
+ params[:extensions].each do |key, value|
54
+ appex_path = Helper::VerifyIpaHelper.appex_path(app_path, key)
55
+ entitlements = self.read_entitlements(params, appex_path)
56
+ self.verify_entitlements(value, entitlements, appex_path)
57
+ end
58
+ end
44
59
  end
45
60
 
46
61
  def self.description
@@ -69,9 +84,19 @@ module Fastlane
69
84
  env_name: 'VERIFY_IPA_APS_ENVIRONMENT',
70
85
  description: 'Key aps-environment in Entitlements',
71
86
  optional: true),
87
+ FastlaneCore::ConfigItem.new(key: :application_groups,
88
+ env_name: 'VERIFY_IPA_APPLICATION_GROUPS',
89
+ description: 'Key com.apple.security.application-groups in Entitlements',
90
+ optional: true,
91
+ type: Array),
72
92
  FastlaneCore::ConfigItem.new(key: :other_params,
73
93
  env_name: 'VERIFY_IPA_OTHER_PARAMS',
74
94
  description: 'A hash of entitlement key and expected values',
95
+ optional: true,
96
+ type: Hash),
97
+ FastlaneCore::ConfigItem.new(key: :extensions,
98
+ env_name: 'VERIFY_IPA_EXTENSIONS',
99
+ description: 'A hash of entitlement key & values for app extensions found under the PlugIns folder',
75
100
  optional: true,
76
101
  type: Hash)
77
102
  ]
@@ -3,7 +3,7 @@ module Fastlane
3
3
  class VerifyIpaFilesAction < Action
4
4
  def self.run(params)
5
5
  Dir.mktmpdir do |dir|
6
- app_path = Helper::VerifyIpaHelper.app_path(params, dir)
6
+ app_path = Helper::VerifyIpaHelper.app_path(params[:ipa_path], dir)
7
7
  self.verify_files(params, app_path)
8
8
  end
9
9
  end
@@ -1,14 +1,20 @@
1
1
  module Fastlane
2
2
  module Helper
3
3
  class VerifyIpaHelper
4
- def self.app_path(params, dir)
5
- ipa_path = params[:ipa_path] || Actions.lane_context[Fastlane::Actions::SharedValues::IPA_OUTPUT_PATH] || ''
4
+ def self.app_path(ipa_path, tmpdir)
5
+ ipa_path ||= Actions.lane_context[Fastlane::Actions::SharedValues::IPA_OUTPUT_PATH] || ''
6
6
  UI.user_error!("Unable to find ipa file '#{ipa_path}'.") unless File.exist?(ipa_path)
7
7
 
8
8
  ipa_path = File.expand_path(ipa_path)
9
- `unzip '#{ipa_path}' -d #{dir}`
9
+ `unzip '#{ipa_path}' -d #{tmpdir}`
10
10
  UI.user_error!("Unable to unzip ipa '#{ipa_path}'") unless $? == 0
11
- Dir["#{dir}/Payload/*.app"].first
11
+ Dir["#{tmpdir}/Payload/*.app"].first
12
+ end
13
+
14
+ def self.appex_path(app_path, appex_name)
15
+ appex_path = "#{app_path}/PlugIns/#{appex_name}.appex"
16
+ UI.user_error!("Unable to find '#{appex_path}'.") unless File.exist?(appex_path)
17
+ appex_path
12
18
  end
13
19
  end
14
20
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module VerifyIpa
3
- VERSION = "0.2.1"
3
+ VERSION = "0.4.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-verify_ipa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derek Yang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-05 00:00:00.000000000 Z
11
+ date: 2017-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plist