motion-provisioning 0.0.7 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -2
- data/bin/export_private_key +0 -0
- data/lib/motion-provisioning.rb +12 -14
- data/lib/motion-provisioning/provisioning_profile.rb +5 -5
- data/lib/motion-provisioning/spaceship/free_portal_client.rb +73 -5
- data/lib/motion-provisioning/spaceship/portal_client.rb +4 -19
- data/lib/motion-provisioning/version.rb +1 -1
- metadata +26 -7
- data/lib/.DS_Store +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83572e34ead0dbc5ff1f9c311ab85037b4f46c76
|
4
|
+
data.tar.gz: 5f45dd856b6dcd387b317201f1bf6b9233442007
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d06e517948d74114699e810431b419b51af91dc31a8af28e89f719bfc32c0e62c1c24db642be52ae9c98eb7517659b45d629473724f70bae8392966e45134147
|
7
|
+
data.tar.gz: d0d156bde61fcf391c116da4743551cb1e251c2a03cfa7bc8692cce9c130046a17ac6736fd6a198f89fdd20bb7ec43a5f3265e7025eb62c43b748c568a47ddd9
|
data/README.md
CHANGED
@@ -50,7 +50,7 @@ MotionProvisioning.certificate(platform: platform,
|
|
50
50
|
|Parameter|Description|
|
51
51
|
|---------|------|
|
52
52
|
|`platform`|`:ios`, `:tvos`, `:mac`|
|
53
|
-
|`type`|`:
|
53
|
+
|`type`|`:beta`, `:distribution`, `:developer_id` (only mac)|
|
54
54
|
|`free`|`true` if you want to use a free developer account. Default: `false`|
|
55
55
|
|
56
56
|
```ruby
|
@@ -180,6 +180,11 @@ For example, to recreate the development profile:
|
|
180
180
|
|
181
181
|
rake device recreate_profile=1
|
182
182
|
|
183
|
+
Or to recreate the development certificate:
|
184
|
+
|
185
|
+
rake device recreate_certificate=1
|
186
|
+
|
187
|
+
|
183
188
|
## Entitlements and App Services
|
184
189
|
|
185
190
|
motion-provisioning does not (yet) manage entitlements and app services (like
|
@@ -199,7 +204,7 @@ You can also add arbitrary device IDs by running:
|
|
199
204
|
|
200
205
|
Then, you will need to recreate the profile to include the newly registered device:
|
201
206
|
|
202
|
-
rake device
|
207
|
+
rake device recreate_profile=1
|
203
208
|
|
204
209
|
## Testing
|
205
210
|
|
data/bin/export_private_key
CHANGED
Binary file
|
data/lib/motion-provisioning.rb
CHANGED
@@ -5,6 +5,7 @@ require 'date'
|
|
5
5
|
|
6
6
|
require 'plist'
|
7
7
|
require 'security'
|
8
|
+
require 'highline/import'
|
8
9
|
require 'spaceship'
|
9
10
|
require 'motion-provisioning/spaceship/portal/certificate'
|
10
11
|
require 'motion-provisioning/spaceship/portal_client'
|
@@ -66,7 +67,7 @@ module MotionProvisioning
|
|
66
67
|
Utils.log("Info", "Logging into the Developer Portal with email '#{email}'.")
|
67
68
|
begin
|
68
69
|
client.user = email
|
69
|
-
client.
|
70
|
+
client.send_shared_login_request(email, password)
|
70
71
|
rescue Spaceship::Client::InvalidUserCredentialsError => ex
|
71
72
|
Utils.log("Error", "There was an error logging into your account. Your password may be wrong.")
|
72
73
|
|
@@ -95,7 +96,7 @@ module MotionProvisioning
|
|
95
96
|
end
|
96
97
|
|
97
98
|
if client.team_id.nil?
|
98
|
-
raise "
|
99
|
+
raise "The current user does not belong to a free team."
|
99
100
|
end
|
100
101
|
else
|
101
102
|
if team_id = MotionProvisioning.config['team_id'] || ENV['MOTION_PROVISIONING_TEAM_ID']
|
@@ -112,23 +113,20 @@ module MotionProvisioning
|
|
112
113
|
raise "The current user does not belong to team with ID '#{team_id}' selected in config.yml."
|
113
114
|
end
|
114
115
|
else
|
115
|
-
|
116
116
|
team_id = client.select_team
|
117
|
-
|
118
|
-
if File.exist?(config_path) && ENV['MOTION_PROVISIONING_TEAM_ID'].nil?
|
119
|
-
answer = Utils.ask("Info", "Do you want to save the team id (#{team_id}) in the config file ('#{MotionProvisioning.output_path}/config.yaml') so you dont have to select it again? (Y/n):")
|
120
|
-
if answer.yes?
|
121
|
-
config = YAML.load(File.read(config_path))
|
122
|
-
config['team_id'] = team_id
|
123
|
-
File.write(config_path, config.to_yaml)
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
117
|
self.team = client.teams.detect { |team| team['teamId'] == team_id }
|
128
118
|
end
|
129
119
|
end
|
130
120
|
|
131
|
-
Utils.log("Info", "Selected team
|
121
|
+
Utils.log("Info", "Selected team \"#{team['name']}\" (#{team['teamId']}).")
|
122
|
+
if File.exist?(config_path) && ENV['MOTION_PROVISIONING_TEAM_ID'].nil? && MotionProvisioning.config['team_id'].nil?
|
123
|
+
answer = Utils.ask("Info", "Do you want to save the team \"#{team['name']}\" (#{team['teamId']}) in the config file ('#{MotionProvisioning.output_path}/config.yaml') so you dont have to select it again? (Y/n):")
|
124
|
+
if answer.yes?
|
125
|
+
config = YAML.load(File.read(config_path))
|
126
|
+
config['team_id'] = team['teamId']
|
127
|
+
File.write(config_path, config.to_yaml)
|
128
|
+
end
|
129
|
+
end
|
132
130
|
|
133
131
|
Spaceship::App.set_client(client)
|
134
132
|
Spaceship::AppGroup.set_client(client)
|
@@ -35,7 +35,7 @@ module MotionProvisioning
|
|
35
35
|
|
36
36
|
app = Application.find_or_create(bundle_id: bundle_id, name: app_name, mac: platform == :mac)
|
37
37
|
|
38
|
-
profile = profile_type.find_by_bundle_id(bundle_id, mac: platform == :mac).detect do |profile|
|
38
|
+
profile = profile_type.find_by_bundle_id(bundle_id: bundle_id, mac: platform == :mac, sub_platform: ('tvOS' if platform == :tvos)).detect do |profile|
|
39
39
|
next if profile.platform.downcase.include?("tvos") && platform != :tvos
|
40
40
|
next if !profile.platform.downcase.include?("tvos") && platform == :tvos
|
41
41
|
profile.name == provisioning_profile_name
|
@@ -124,10 +124,10 @@ module MotionProvisioning
|
|
124
124
|
# The kind of provisioning profile we're interested in
|
125
125
|
def profile_type
|
126
126
|
return @profile_type if @profile_type
|
127
|
-
@profile_type = Spaceship.provisioning_profile.app_store
|
128
|
-
@profile_type = Spaceship.provisioning_profile.in_house if client.in_house?
|
129
|
-
@profile_type = Spaceship.provisioning_profile.ad_hoc if self.type == :adhoc
|
130
|
-
@profile_type = Spaceship.provisioning_profile.development if self.type == :development
|
127
|
+
@profile_type = Spaceship::Portal.provisioning_profile.app_store
|
128
|
+
@profile_type = Spaceship::Portal.provisioning_profile.in_house if client.in_house?
|
129
|
+
@profile_type = Spaceship::Portal.provisioning_profile.ad_hoc if self.type == :adhoc
|
130
|
+
@profile_type = Spaceship::Portal.provisioning_profile.development if self.type == :development
|
131
131
|
@profile_type
|
132
132
|
end
|
133
133
|
end
|
@@ -1,7 +1,48 @@
|
|
1
1
|
module Spaceship
|
2
2
|
class FreePortalClient < Spaceship::PortalClient
|
3
|
+
XCODE_VERSION = '9.2 (9C40b)'
|
3
4
|
|
4
|
-
def
|
5
|
+
def teams
|
6
|
+
return @teams if @teams
|
7
|
+
req = request(:post, "https://developerservices2.apple.com/services/#{PROTOCOL_VERSION}/listTeams.action", nil, {
|
8
|
+
'X-Xcode-Version' => XCODE_VERSION # necessary in order to work with Xcode free team
|
9
|
+
})
|
10
|
+
@teams = parse_response(req, 'teams').sort_by do |team|
|
11
|
+
[
|
12
|
+
team['name'],
|
13
|
+
team['teamId']
|
14
|
+
]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def development_certificates(mac: false)
|
19
|
+
paging do |page_number|
|
20
|
+
r = request(:post, "https://developerservices2.apple.com/services/#{PROTOCOL_VERSION}/#{platform_slug(mac)}/listAllDevelopmentCerts.action?clientId=XABBG36SBA&teamId=#{team_id}", nil, {
|
21
|
+
'X-Xcode-Version' => XCODE_VERSION # necessary in order to work with Xcode free team
|
22
|
+
})
|
23
|
+
parse_response(r, 'certificates')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def provisioning_profiles_via_xcode_api(mac: false)
|
28
|
+
req = request(:post) do |r|
|
29
|
+
r.url("https://developerservices2.apple.com/services/#{PROTOCOL_VERSION}/#{platform_slug(mac)}/listProvisioningProfiles.action")
|
30
|
+
r.params = {
|
31
|
+
teamId: team_id,
|
32
|
+
includeInactiveProfiles: true,
|
33
|
+
onlyCountLists: true
|
34
|
+
}
|
35
|
+
r.headers['X-Xcode-Version'] = XCODE_VERSION # necessary in order to work with Xcode free team
|
36
|
+
end
|
37
|
+
|
38
|
+
result = parse_response(req, 'provisioningProfiles')
|
39
|
+
|
40
|
+
csrf_cache[Spaceship::Portal::ProvisioningProfile] = self.csrf_tokens
|
41
|
+
|
42
|
+
result
|
43
|
+
end
|
44
|
+
|
45
|
+
def create_provisioning_profile!(name, distribution_method, app_id, certificate_ids, device_ids, mac: false, sub_platform: nil, template_name: nil)
|
5
46
|
ensure_csrf(Spaceship::App)
|
6
47
|
|
7
48
|
params = {
|
@@ -67,12 +108,36 @@ module Spaceship
|
|
67
108
|
parse_response(r, 'appId')
|
68
109
|
end
|
69
110
|
|
70
|
-
def create_app!(type, name, bundle_id, mac: false)
|
111
|
+
def create_app!(type, name, bundle_id, mac: false, enable_services: {})
|
112
|
+
# We moved the ensure_csrf to the top of this method
|
113
|
+
# as we got some users with issues around creating new apps
|
114
|
+
# https://github.com/fastlane/fastlane/issues/5813
|
115
|
+
ensure_csrf(Spaceship::Portal::App)
|
116
|
+
|
117
|
+
ident_params = case type.to_sym
|
118
|
+
when :explicit
|
119
|
+
{
|
120
|
+
type: 'explicit',
|
121
|
+
# push: 'on', # Not available to free teams
|
122
|
+
# inAppPurchase: 'on', # Not available to free teams
|
123
|
+
gameCenter: 'on'
|
124
|
+
}
|
125
|
+
when :wildcard
|
126
|
+
{
|
127
|
+
type: 'wildcard',
|
128
|
+
}
|
129
|
+
end
|
130
|
+
|
71
131
|
params = {
|
72
132
|
identifier: bundle_id,
|
73
133
|
name: name,
|
74
134
|
teamId: team_id
|
75
135
|
}
|
136
|
+
params.merge!(ident_params)
|
137
|
+
|
138
|
+
enable_services.each do |k, v|
|
139
|
+
params[v.service_id.to_sym] = v.value
|
140
|
+
end
|
76
141
|
|
77
142
|
ensure_csrf(Spaceship::App)
|
78
143
|
|
@@ -102,12 +167,15 @@ module Spaceship
|
|
102
167
|
private
|
103
168
|
|
104
169
|
def request_plist(method, url_or_path = nil, params = nil, headers = {}, &block)
|
105
|
-
headers['X-Xcode-Version'] =
|
106
|
-
headers['
|
170
|
+
headers['X-Xcode-Version'] = XCODE_VERSION
|
171
|
+
headers['Accept'] = 'text/x-xml-plist'
|
107
172
|
headers['User-Agent'] = USER_AGENT
|
108
173
|
headers.merge!(csrf_tokens)
|
109
174
|
|
110
|
-
|
175
|
+
if params
|
176
|
+
headers['Content-Type'] = 'text/x-xml-plist'
|
177
|
+
params = params.to_plist
|
178
|
+
end
|
111
179
|
|
112
180
|
send_request(method, url_or_path, params, headers, &block)
|
113
181
|
end
|
@@ -1,32 +1,17 @@
|
|
1
1
|
module Spaceship
|
2
2
|
class PortalClient < Spaceship::Client
|
3
|
-
def
|
3
|
+
def development_certificates(mac: false)
|
4
4
|
paging do |page_number|
|
5
|
-
r = request(:post, "https://developerservices2.apple.com/services/#{PROTOCOL_VERSION}/#{platform_slug(mac)}/
|
5
|
+
r = request(:post, "https://developerservices2.apple.com/services/#{PROTOCOL_VERSION}/#{platform_slug(mac)}/listAllDevelopmentCerts.action?clientId=XABBG36SBA&teamId=#{team_id}")
|
6
6
|
parse_response(r, 'certificates')
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
10
|
+
def distribution_certificates(mac: false)
|
11
11
|
paging do |page_number|
|
12
|
-
r = request(:post, "https://developerservices2.apple.com/services/#{PROTOCOL_VERSION}/#{platform_slug(mac)}/
|
12
|
+
r = request(:post, "https://developerservices2.apple.com/services/#{PROTOCOL_VERSION}/#{platform_slug(mac)}/downloadDistributionCerts.action?clientId=XABBG36SBA&teamId=#{team_id}")
|
13
13
|
parse_response(r, 'certificates')
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
17
|
-
# Fix a bug in Fastlane where the slug is hardcoded to ios
|
18
|
-
def create_certificate!(type, csr, app_id = nil)
|
19
|
-
ensure_csrf(Spaceship::Certificate)
|
20
|
-
|
21
|
-
mac = Spaceship::Portal::Certificate::MAC_CERTIFICATE_TYPE_IDS.keys.include?(type)
|
22
|
-
|
23
|
-
r = request(:post, "account/#{platform_slug(mac)}/certificate/submitCertificateRequest.action", {
|
24
|
-
teamId: team_id,
|
25
|
-
type: type,
|
26
|
-
csrContent: csr,
|
27
|
-
appIdId: app_id # optional
|
28
|
-
})
|
29
|
-
parse_response(r, 'certRequest')
|
30
|
-
end
|
31
16
|
end
|
32
17
|
end
|
metadata
CHANGED
@@ -1,29 +1,49 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-provisioning
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Villacampa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: highline
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.7.2
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.0.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.7.2
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.0.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: fastlane
|
15
35
|
requirement: !ruby/object:Gem::Requirement
|
16
36
|
requirements:
|
17
37
|
- - "~>"
|
18
38
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
39
|
+
version: '2.85'
|
20
40
|
type: :runtime
|
21
41
|
prerelease: false
|
22
42
|
version_requirements: !ruby/object:Gem::Requirement
|
23
43
|
requirements:
|
24
44
|
- - "~>"
|
25
45
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
46
|
+
version: '2.85'
|
27
47
|
- !ruby/object:Gem::Dependency
|
28
48
|
name: bundler
|
29
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -119,7 +139,6 @@ files:
|
|
119
139
|
- LICENSE.txt
|
120
140
|
- README.md
|
121
141
|
- bin/export_private_key
|
122
|
-
- lib/.DS_Store
|
123
142
|
- lib/motion-provisioning.rb
|
124
143
|
- lib/motion-provisioning/application.rb
|
125
144
|
- lib/motion-provisioning/certificate.rb
|
@@ -151,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
170
|
version: '0'
|
152
171
|
requirements: []
|
153
172
|
rubyforge_project:
|
154
|
-
rubygems_version: 2.
|
173
|
+
rubygems_version: 2.6.13
|
155
174
|
signing_key:
|
156
175
|
specification_version: 4
|
157
176
|
summary: Simplified provisioning for RubyMotion iOS, tvOS and macOS apps.
|
data/lib/.DS_Store
DELETED
Binary file
|