match 0.9.0 → 0.10.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
2
  SHA1:
3
- metadata.gz: f3cf7e4c9af9050a9b6e8f6a7c5c760bc281c92b
4
- data.tar.gz: c76983326e8d722aeff558973124604555adf5e0
3
+ metadata.gz: ca106e53fcfa3a6afb2796907c6375bbeb4712ea
4
+ data.tar.gz: b2dfe54acc43db599594d53e142a1a53525f33be
5
5
  SHA512:
6
- metadata.gz: e4aca4ba5efcd4ab989d0d04969b418632ae2840de179a9ad3469d2f43655809495753a34d8d1aa8202231951790fafbf1da7291093065d03cd1330024ca1292
7
- data.tar.gz: 89e4be72b960293545dc25678dc71db2402f4da7c8fb4ec280be44d2bc2574376b861ab43e685e822d30d58bcef8b0afa2921943687c810695a909d55081151d
6
+ metadata.gz: 4fe6fc7d7b53ca65690898254cefe1c3119ed3525c8a8ec26c01c39595fe601742312dce8a8938f6f0c23da684a1d15078c05d98da75b4801252d31946c85027
7
+ data.tar.gz: 14552497d001e8d507c5fede87a21afdee863e7afa930429a2c224b0459c7513338f37536594f9c5fff7b603af30bb448b7d41dd4e304fc99034681af61309e8
@@ -26,7 +26,26 @@ module Match
26
26
  return envs
27
27
  end
28
28
 
29
+ # @return [Boolean] returns true if the unsupported enterprise mode should be enabled
29
30
  def self.enterprise?
30
31
  ENV["MATCH_FORCE_ENTERPRISE"]
31
32
  end
33
+
34
+ # @return [Boolean] returns true if match should interpret the given [certificate|profile] type as an enterprise one
35
+ def self.type_is_enterprise?(type)
36
+ Match.enterprise? && type != "development"
37
+ end
38
+
39
+ def self.profile_type_sym(type)
40
+ return :enterprise if self.type_is_enterprise? type
41
+ return :adhoc if type == "adhoc"
42
+ return :appstore if type == "appstore"
43
+ return :development
44
+ end
45
+
46
+ def self.cert_type_sym(type)
47
+ return :enterprise if self.type_is_enterprise? type
48
+ return :development if type == "development"
49
+ return :distribution
50
+ end
32
51
  end
@@ -36,7 +36,7 @@ module Match
36
36
  def self.generate_provisioning_profile(params: nil, prov_type: nil, certificate_id: nil, app_identifier: nil)
37
37
  require 'sigh'
38
38
 
39
- prov_type = :enterprise if Match.enterprise? && ENV["SIGH_PROFILE_ENTERPRISE"] && !params[:type] == "development"
39
+ prov_type = Match.profile_type_sym(params[:type])
40
40
 
41
41
  profile_name = ["match", profile_type_name(prov_type), app_identifier].join(" ")
42
42
 
@@ -47,7 +47,7 @@ module Match
47
47
  # Collect all the certs/profiles
48
48
  def prepare_list
49
49
  UI.message "Fetching certificates and profiles..."
50
- cert_type = type.to_sym
50
+ cert_type = Match.cert_type_sym(type)
51
51
 
52
52
  prov_types = [:development]
53
53
  prov_types = [:appstore, :adhoc] if cert_type == :distribution
@@ -1,6 +1,7 @@
1
1
  module Match
2
2
  class Runner
3
3
  attr_accessor :changes_to_commit
4
+ attr_accessor :spaceship
4
5
 
5
6
  def run(params)
6
7
  FastlaneCore::PrintTable.print_values(config: params,
@@ -10,7 +11,7 @@ module Match
10
11
  UI.error("Enterprise profiles are currently not officially supported in _match_, you might run into issues") if Match.enterprise?
11
12
 
12
13
  params[:workspace] = GitHelper.clone(params[:git_url], params[:shallow_clone], skip_docs: params[:skip_docs], branch: params[:git_branch])
13
- spaceship = SpaceshipEnsure.new(params[:username]) unless params[:readonly]
14
+ self.spaceship = SpaceshipEnsure.new(params[:username]) unless params[:readonly]
14
15
 
15
16
  if params[:app_identifier].kind_of?(Array)
16
17
  app_identifiers = params[:app_identifier]
@@ -31,10 +32,11 @@ module Match
31
32
 
32
33
  # Provisioning Profiles
33
34
  app_identifiers.each do |app_identifier|
34
- uuid = fetch_provisioning_profile(params: params,
35
- certificate_id: cert_id,
36
- app_identifier: app_identifier)
37
- spaceship.profile_exists(username: params[:username], uuid: uuid) if spaceship
35
+ loop do
36
+ break if fetch_provisioning_profile(params: params,
37
+ certificate_id: cert_id,
38
+ app_identifier: app_identifier)
39
+ end
38
40
  end
39
41
 
40
42
  # Done
@@ -60,9 +62,7 @@ module Match
60
62
  end
61
63
 
62
64
  def fetch_certificate(params: nil)
63
- cert_type = :distribution
64
- cert_type = :development if params[:type] == "development"
65
- cert_type = :enterprise if Match.enterprise? && params[:type] == "enterprise"
65
+ cert_type = Match.cert_type_sym(params[:type])
66
66
 
67
67
  certs = Dir[File.join(params[:workspace], "certs", cert_type.to_s, "*.cer")]
68
68
  keys = Dir[File.join(params[:workspace], "certs", cert_type.to_s, "*.p12")]
@@ -92,10 +92,11 @@ module Match
92
92
 
93
93
  # @return [String] The UUID of the provisioning profile so we can verify it with the Apple Developer Portal
94
94
  def fetch_provisioning_profile(params: nil, certificate_id: nil, app_identifier: nil)
95
- prov_type = params[:type].to_sym
95
+ prov_type = Match.profile_type_sym(params[:type])
96
96
 
97
97
  profile_name = [Match::Generator.profile_type_name(prov_type), app_identifier].join("_").gsub("*", '\*') # this is important, as it shouldn't be a wildcard
98
- profiles = Dir[File.join(params[:workspace], "profiles", prov_type.to_s, "#{profile_name}.mobileprovision")]
98
+ base_dir = File.join(params[:workspace], "profiles", prov_type.to_s)
99
+ profiles = Dir[File.join(base_dir, "#{profile_name}.mobileprovision")]
99
100
 
100
101
  # Install the provisioning profiles
101
102
  profile = profiles.last
@@ -105,7 +106,15 @@ module Match
105
106
  end
106
107
 
107
108
  if profile.nil? or params[:force]
108
- UI.user_error!("No matching provisioning profiles found and can not create a new one because you enabled `readonly`") if params[:readonly]
109
+ if params[:readonly]
110
+ all_profiles = Dir.entries(base_dir).reject { |f| f.start_with? "." }
111
+ UI.error "No matching provisioning profiles found for '#{profile_name}'"
112
+ UI.error "A new one cannot be created because you enabled `readonly`"
113
+ UI.error "Provisioning profiles in your repo for type `#{prov_type}`:"
114
+ all_profiles.each { |p| UI.error "- '#{p}'" }
115
+ UI.error "If you are certain that a profile should exist, double-check the recent changes to your match repository"
116
+ UI.user_error! "No matching provisioning profiles found and can not create a new one because you enabled `readonly`. Check the output above for more information."
117
+ end
109
118
  profile = Generator.generate_provisioning_profile(params: params,
110
119
  prov_type: prov_type,
111
120
  certificate_id: certificate_id,
@@ -118,6 +127,13 @@ module Match
118
127
  parsed = FastlaneCore::ProvisioningProfile.parse(profile)
119
128
  uuid = parsed["UUID"]
120
129
 
130
+ if spaceship && !spaceship.profile_exists(username: params[:username], uuid: uuid)
131
+ # This profile is invalid, let's remove the local file and generate a new one
132
+ File.delete(profile)
133
+ self.changes_to_commit = true
134
+ return nil
135
+ end
136
+
121
137
  Utils.fill_environment(Utils.environment_variable_name(app_identifier: app_identifier,
122
138
  type: prov_type),
123
139
  uuid)
@@ -54,13 +54,25 @@ module Match
54
54
  found = Spaceship.provisioning_profile.all.find do |profile|
55
55
  profile.uuid == uuid
56
56
  end
57
- return if found
58
57
 
59
- UI.error("Provisioning profile '#{uuid}' is not available on the Developer Portal")
60
- UI.error("for the user #{username}")
61
- UI.error("Make sure to use the same user and team every time you run 'match' for this")
62
- UI.error("Git repository. This might be caused by deleting the provisioning profile on the Dev Portal")
63
- UI.user_error!("To reset the provisioning profiles of your Apple account, you can use the `match nuke` feature, more information on https://github.com/fastlane/fastlane/tree/master/match")
58
+ unless found
59
+ UI.error("Provisioning profile '#{uuid}' is not available on the Developer Portal")
60
+ UI.error("for the user #{username}")
61
+ UI.error("Make sure to use the same user and team every time you run 'match' for this")
62
+ UI.error("Git repository. This might be caused by deleting the provisioning profile on the Dev Portal")
63
+ UI.user_error!("To reset the provisioning profiles of your Apple account, you can use the `match nuke` feature, more information on https://github.com/fastlane/fastlane/tree/master/match")
64
+ end
65
+
66
+ if found.valid?
67
+ return found
68
+ else
69
+ UI.important("'#{found.name}' is available on the Developer Portal, however it's 'Invalid', fixing this now for you 🔨")
70
+ # it's easier to just create a new one, than to repair an existing profile
71
+ # it has the same effects anyway, including a new UUID of the provisioning profile
72
+ found.delete!
73
+ # return nil to re-download the new profile in runner.rb
74
+ return nil
75
+ end
64
76
  end
65
77
  end
66
78
  end
@@ -1,4 +1,4 @@
1
1
  module Match
2
- VERSION = "0.9.0"
2
+ VERSION = "0.10.0"
3
3
  DESCRIPTION = "Easily sync your certificates and profiles across your team using git"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: match
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-24 00:00:00.000000000 Z
11
+ date: 2016-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: security