deploygate 0.6.8 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +7 -2
- data/README.md +9 -2
- data/config/locales/en.yml +6 -10
- data/deploygate.gemspec +3 -3
- data/lib/deploygate.rb +1 -0
- data/lib/deploygate/add_devices_server.rb +6 -7
- data/lib/deploygate/api/v1/base.rb +5 -1
- data/lib/deploygate/command_builder.rb +4 -1
- data/lib/deploygate/commands/add_devices.rb +20 -25
- data/lib/deploygate/commands/deploy/build.rb +11 -31
- data/lib/deploygate/version.rb +1 -1
- data/lib/deploygate/xcode/analyze.rb +55 -115
- data/lib/deploygate/xcode/export.rb +20 -14
- data/lib/deploygate/xcode/ios.rb +7 -1
- data/lib/deploygate/xcode/member_center.rb +2 -5
- data/lib/deploygate/xcode/member_centers/app.rb +3 -2
- data/lib/deploygate/xcode/member_centers/device.rb +14 -6
- data/lib/deploygate/xcode/member_centers/provisioning_profile.rb +13 -7
- data/spec/deploygate/xcode/analyze_spec.rb +0 -57
- data/spec/deploygate/xcode/export_spec.rb +25 -3
- data/spec/deploygate/xcode/ios_spec.rb +3 -0
- data/spec/deploygate/xcode/member_center_spec.rb +1 -1
- data/spec/deploygate/xcode/member_centers/app_spec.rb +4 -3
- metadata +17 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 785a1c89bea29d385d1bedb4deaeb9ce8148a5de83aaef2fbe889bb7b062c174
|
|
4
|
+
data.tar.gz: 4c939c3a624ef686da3ce629b82ff445b59fcbf1267e887c55e5feed468d71fe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 37644e62c47447cb9f6c9c0c974a0f9ffe6dc33ad67fc6399af8058bc6e50e0cc924f0526627a3a3a135202b8af251d3a6a90e268150126547266cb30bbbc6dc
|
|
7
|
+
data.tar.gz: f9460ac50d4e6c34ae5560cd4ea7de5cfb82c6ac5b3d8952e5681826a3bcbbe4abfddce7ed1f078a322a2c1739c0c11576b2f970a176a00a7ec4443abe8489af
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.4.5
|
data/.travis.yml
CHANGED
|
@@ -3,9 +3,13 @@ env:
|
|
|
3
3
|
global:
|
|
4
4
|
secure: gGY+C54Cfp082o5Oaf6tZqzfOlXsWSMcVNvTpoOgMfJGsHo//d9t/si9Bn1pFaFyjJedW+IcC0pt+FcKVCDgnsUaL0Y0HT/ZsGkV8k7vv9F5nbHOde4nk189Sr2HtHR3wdr7KaMh2/DialisnqllxgzxA/wRLfHKsjqRsjWUw/VWL5E7Z734mzpTGE2mVJNRj02/cs0Y/izZgdi6wrt4lEZfxE3jS+QkJZHMjGNfcwvH26whU6oX1PiJ4o5xl0Rr8Q8xav3wbtTCcOJNPSeMkkiH5sSXuqrjI6kgwvjlByKhyg2Ws0GvZLxAfTml+Vo5po1uWsohdZJaJcEhd4GsGfbMZWCFuBP2mCE+gVmkkMeJxRKnWoi6NotgPmqG1JWlzGngDB/hJ4wuuh+swa0KJvZGiMEJ5P3GNydCybEPOsk1Ww+lUkXRHxD+/LW03EkxMd5LA3He/nYXz3pWCYA6qcFgrYMmq+3ozjSaQr+1d/Iu14Awv5+cwCltPfl5bERDno0jc0TdSs/7qplAL/efpjBsP7DkGE5r521gg8mIiXx509jU08i9S60SXiw0RBnYyjE5SzlsiOqaFdJxVygDGcDIAA/GTefLHO9i3SinZHFS6jr3Xi/vpOIc7Jz4W2Jmuqv+CJP4gspPoAxdWOE/QipTt0Jv4kCMf7dJwd9jaRc=
|
|
5
5
|
rvm:
|
|
6
|
-
- 2.
|
|
6
|
+
- 2.4
|
|
7
|
+
- 2.5
|
|
8
|
+
- 2.6
|
|
9
|
+
- 2.7
|
|
7
10
|
before_install:
|
|
8
|
-
- gem install bundler -v 1.
|
|
11
|
+
- gem install bundler -v 2.1.4
|
|
12
|
+
install: BUNDLER_VERSION=2.1.4 bundle install --jobs=3 --retry=3
|
|
9
13
|
script:
|
|
10
14
|
- bundle exec rake
|
|
11
15
|
deploy:
|
|
@@ -16,5 +20,6 @@ deploy:
|
|
|
16
20
|
on:
|
|
17
21
|
tags: true
|
|
18
22
|
repo: DeployGate/deploygate-cli
|
|
23
|
+
rvm: 2.4
|
|
19
24
|
after_deploy:
|
|
20
25
|
- 'curl -X POST --data-urlencode "payload={\"text\": \"Released a deploygate gem in <https://rubygems.org/gems/deploygate/|RubyGems>\"}" $SLACK_URL'
|
data/README.md
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
# deploygate-cli
|
|
2
|
+
|
|
2
3
|
[](https://badge.fury.io/rb/deploygate)
|
|
3
4
|
[](https://travis-ci.org/DeployGate/deploygate-cli)
|
|
4
5
|
|
|
5
|
-
A command-line interface for DeployGate
|
|
6
|
+
dg: A command-line interface for DeployGate
|
|
7
|
+
|
|
8
|
+
## Requirements
|
|
9
|
+
|
|
10
|
+
*dg* runs with a minimal set of requirements.
|
|
11
|
+
|
|
12
|
+
- Ruby 2.4+ (Depends on [Ruby Maintenance Branches](https://www.ruby-lang.org/en/downloads/branches/))
|
|
6
13
|
|
|
7
14
|
## Installation
|
|
8
15
|
|
|
@@ -42,7 +49,7 @@ $ dg deploy [Android/iOS project path]
|
|
|
42
49
|
|
|
43
50
|
## License
|
|
44
51
|
|
|
45
|
-
Copyright (C) 2015 DeployGate All rights reserved.
|
|
52
|
+
Copyright (C) 2015- DeployGate All rights reserved.
|
|
46
53
|
|
|
47
54
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
|
|
48
55
|
|
data/config/locales/en.yml
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
en:
|
|
3
|
+
errors:
|
|
4
|
+
check_update_failure: 'Checking update failed'
|
|
3
5
|
command_builder:
|
|
4
6
|
name: 'dg'
|
|
5
7
|
description: 'Control DeployGate from your terminal.'
|
|
@@ -142,27 +144,21 @@ en:
|
|
|
142
144
|
choice: '%{team_name} %{team_id}'
|
|
143
145
|
check_local_certificates:
|
|
144
146
|
not_local_install_certificate:
|
|
145
|
-
error_message: 'Error: No applicable iPhone Distribution certificate found on your Mac.'
|
|
147
|
+
error_message: 'Error: No applicable iPhone Distribution or Apple Distribution certificate found on your Mac.'
|
|
146
148
|
note: |
|
|
147
|
-
No "iPhone Distribution" certificate and/or corresponding private key installed locally.
|
|
149
|
+
No "iPhone Distribution" or "Apple Distribution" certificate and/or corresponding private key installed locally.
|
|
148
150
|
To sign your application code, make sure you have installed them and available in your Keychain.
|
|
149
151
|
|
|
150
152
|
See also: https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/MaintainingCertificates/MaintainingCertificates.html
|
|
151
153
|
conflict_certificate:
|
|
152
154
|
error_message: 'Error: Too many certificates found.'
|
|
153
155
|
note: |
|
|
154
|
-
You have more than one "iPhone Distribution" certificate installed on your Mac.
|
|
156
|
+
You have more than one "iPhone Distribution" or "Apple Distribution" certificate installed on your Mac.
|
|
155
157
|
Please remove other unnecessary certificates from your Keychain.
|
|
156
158
|
clean_provisioning_profiles:
|
|
157
159
|
start: 'Cleaning local Provisioning Profiles...'
|
|
158
160
|
delete: 'Delete %{path}'
|
|
159
161
|
finish: 'Finish cleaning local Provisionig Profiles'
|
|
160
|
-
analyze:
|
|
161
|
-
target_bundle_identifier:
|
|
162
|
-
prompt: |
|
|
163
|
-
Please input your app bundle identifier
|
|
164
|
-
Example: com.example.ios
|
|
165
|
-
ask: 'Enter your app bundle identifier: '
|
|
166
162
|
ios:
|
|
167
163
|
build:
|
|
168
164
|
error:
|
|
@@ -177,5 +173,5 @@ en:
|
|
|
177
173
|
Note: Your password will be stored to your Keychain and never be sent to DeployGate.
|
|
178
174
|
email: 'Email: '
|
|
179
175
|
provisioning_profile:
|
|
180
|
-
not_installed_certificate_error: 'No iPhone Distribution Certificate associated with private key was found in local Keychain'
|
|
176
|
+
not_installed_certificate_error: 'No iPhone Distribution or Apple Distribution Certificate associated with private key was found in local Keychain'
|
|
181
177
|
not_exist_uuid_provisioning_profile_error: 'No provisioning profile found for the specified UUID (%{uuid})'
|
data/deploygate.gemspec
CHANGED
|
@@ -20,7 +20,7 @@ dg installed! To get started fast:
|
|
|
20
20
|
|
|
21
21
|
POST_INSTALL_MESSAGE
|
|
22
22
|
|
|
23
|
-
spec.add_runtime_dependency 'json', '~>
|
|
23
|
+
spec.add_runtime_dependency 'json', '~> 2.0'
|
|
24
24
|
spec.add_runtime_dependency 'httpclient', '~> 2.8'
|
|
25
25
|
spec.add_runtime_dependency 'commander', '~> 4.4'
|
|
26
26
|
spec.add_runtime_dependency 'plist', '~> 3.1'
|
|
@@ -38,9 +38,9 @@ POST_INSTALL_MESSAGE
|
|
|
38
38
|
spec.add_runtime_dependency 'sentry-raven', '~> 2.8'
|
|
39
39
|
|
|
40
40
|
# ios build
|
|
41
|
-
spec.add_runtime_dependency 'fastlane', '~> 2.
|
|
41
|
+
spec.add_runtime_dependency 'fastlane', '~> 2.148.1'
|
|
42
42
|
|
|
43
|
-
spec.add_development_dependency 'bundler', '
|
|
43
|
+
spec.add_development_dependency 'bundler', '>= 2.1.4', '< 3.0'
|
|
44
44
|
spec.add_development_dependency 'rake', '~> 12.0'
|
|
45
45
|
spec.add_development_dependency 'rspec', '~> 3.5'
|
|
46
46
|
spec.add_development_dependency 'webmock', '~> 2.3'
|
data/lib/deploygate.rb
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
module DeployGate
|
|
2
2
|
class AddDevicesServer
|
|
3
3
|
|
|
4
|
-
def start(token, owner_name, bundle_id, distribution_key, args, options)
|
|
5
|
-
DeployGate::Xcode::MemberCenter.instance
|
|
4
|
+
def start(token, owner_name, bundle_id, distribution_key, member_center, args, options)
|
|
6
5
|
options.server = false
|
|
7
6
|
|
|
8
7
|
puts I18n.t('command_builder.add_devices.server.connecting')
|
|
@@ -15,7 +14,7 @@ module DeployGate
|
|
|
15
14
|
raise res[:message]
|
|
16
15
|
end
|
|
17
16
|
|
|
18
|
-
websocket_setup(server, bundle_id, push_token, action, args, options) do |socket|
|
|
17
|
+
websocket_setup(server, bundle_id, push_token, action, member_center, args, options) do |socket|
|
|
19
18
|
puts HighLine.color(I18n.t('command_builder.add_devices.server.start'), HighLine::GREEN)
|
|
20
19
|
|
|
21
20
|
Workers::PeriodicTimer.new(60) do
|
|
@@ -33,12 +32,12 @@ module DeployGate
|
|
|
33
32
|
end
|
|
34
33
|
end
|
|
35
34
|
|
|
36
|
-
def self.build(pool, bunlde_id, iphones, args, options)
|
|
35
|
+
def self.build(pool, bunlde_id, iphones, member_center, args, options)
|
|
37
36
|
iphones.reject! { |iphone| iphone['is_registered'] } # remove udids if already registered
|
|
38
37
|
devices = iphones.map do |iphone|
|
|
39
38
|
udid = iphone['udid']
|
|
40
39
|
device_name= iphone['device_name']
|
|
41
|
-
DeployGate::Xcode::MemberCenters::Device.new(udid, '', device_name)
|
|
40
|
+
DeployGate::Xcode::MemberCenters::Device.new(udid, '', device_name, member_center)
|
|
42
41
|
end
|
|
43
42
|
return if devices.empty?
|
|
44
43
|
|
|
@@ -53,7 +52,7 @@ module DeployGate
|
|
|
53
52
|
|
|
54
53
|
private
|
|
55
54
|
|
|
56
|
-
def websocket_setup(server, bundle_id, push_token, target_action, args, options, &block)
|
|
55
|
+
def websocket_setup(server, bundle_id, push_token, target_action, member_center, args, options, &block)
|
|
57
56
|
socket = SocketIO::Client::Simple.connect server
|
|
58
57
|
socket.on :connect do
|
|
59
58
|
socket.emit :subscribe, push_token
|
|
@@ -72,7 +71,7 @@ module DeployGate
|
|
|
72
71
|
data = JSON.parse(push_data['data'])
|
|
73
72
|
|
|
74
73
|
iphones = data['iphones']
|
|
75
|
-
DeployGate::AddDevicesServer.build(pool, bundle_id, iphones, args, options)
|
|
74
|
+
DeployGate::AddDevicesServer.build(pool, bundle_id, iphones, member_center, args, options)
|
|
76
75
|
end
|
|
77
76
|
end
|
|
78
77
|
end
|
|
@@ -45,7 +45,11 @@ module DeployGate
|
|
|
45
45
|
private
|
|
46
46
|
|
|
47
47
|
def client
|
|
48
|
-
|
|
48
|
+
timeout = 60 * 5 # 5 minutes
|
|
49
|
+
HTTPClient.new(agent_name: "dg/#{DeployGate::VERSION}").tap do |c|
|
|
50
|
+
c.receive_timeout = timeout
|
|
51
|
+
c.send_timeout = timeout
|
|
52
|
+
end
|
|
49
53
|
end
|
|
50
54
|
|
|
51
55
|
def headers
|
|
@@ -40,6 +40,7 @@ module DeployGate
|
|
|
40
40
|
def run
|
|
41
41
|
setup()
|
|
42
42
|
|
|
43
|
+
program :help_paging, false
|
|
43
44
|
program :name, I18n.t('command_builder.name')
|
|
44
45
|
program :version, VERSION
|
|
45
46
|
program :description, I18n.t('command_builder.description')
|
|
@@ -149,7 +150,7 @@ module DeployGate
|
|
|
149
150
|
tags[:xcode_version] = version if version.present?
|
|
150
151
|
|
|
151
152
|
puts ''
|
|
152
|
-
puts error_report(error,
|
|
153
|
+
puts error_report(error, dg_version, version)
|
|
153
154
|
if HighLine.agree(I18n.t('command_builder.error_handling.agree')) {|q| q.default = "y"}
|
|
154
155
|
tags = {
|
|
155
156
|
command: command,
|
|
@@ -202,6 +203,8 @@ EOF
|
|
|
202
203
|
else
|
|
203
204
|
request_gem_update_checker
|
|
204
205
|
end
|
|
206
|
+
rescue => e
|
|
207
|
+
STDERR.puts I18n.t('errors.check_update_failure')
|
|
205
208
|
end
|
|
206
209
|
|
|
207
210
|
# @return [void]
|
|
@@ -21,22 +21,27 @@ module DeployGate
|
|
|
21
21
|
distribution_key = options.distribution_key
|
|
22
22
|
server = options.server
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
root_path = DeployGate::Xcode::Ios.project_root_path(work_dir)
|
|
25
|
+
workspaces = DeployGate::Xcode::Ios.find_workspaces(root_path)
|
|
26
|
+
analyze = DeployGate::Xcode::Analyze.new(workspaces, options.configuration)
|
|
27
|
+
bundle_id = analyze.target_bundle_identifier
|
|
28
|
+
developer_team = analyze.developer_team
|
|
29
|
+
member_center = DeployGate::Xcode::MemberCenter.new(developer_team)
|
|
25
30
|
|
|
26
31
|
if server
|
|
27
|
-
run_server(session, owner, bundle_id, distribution_key, args, options)
|
|
32
|
+
run_server(session, owner, bundle_id, distribution_key, member_center, args, options)
|
|
28
33
|
else
|
|
29
|
-
device_register(session, owner, udid, device_name, bundle_id, args, options)
|
|
34
|
+
device_register(session, owner, udid, device_name, bundle_id, member_center, args, options)
|
|
30
35
|
end
|
|
31
36
|
end
|
|
32
37
|
|
|
33
|
-
def run_server(session, owner, bundle_id, distribution_key, args, options)
|
|
34
|
-
DeployGate::AddDevicesServer.new().start(session.token, owner, bundle_id, distribution_key, args, options)
|
|
38
|
+
def run_server(session, owner, bundle_id, distribution_key, member_center, args, options)
|
|
39
|
+
DeployGate::AddDevicesServer.new().start(session.token, owner, bundle_id, distribution_key, member_center, args, options)
|
|
35
40
|
end
|
|
36
41
|
|
|
37
|
-
def device_register(session, owner, udid, device_name, bundle_id, args, options)
|
|
42
|
+
def device_register(session, owner, udid, device_name, bundle_id, member_center, args, options)
|
|
38
43
|
if udid.nil? && device_name.nil?
|
|
39
|
-
devices = fetch_devices(session.token, owner, bundle_id)
|
|
44
|
+
devices = fetch_devices(session.token, owner, bundle_id, member_center)
|
|
40
45
|
select_devices = select_devices(devices)
|
|
41
46
|
not_device if select_devices.empty?
|
|
42
47
|
|
|
@@ -44,7 +49,7 @@ module DeployGate
|
|
|
44
49
|
else
|
|
45
50
|
register_udid = udid || HighLine.ask(I18n.t('commands.add_devices.input_udid'))
|
|
46
51
|
register_device_name = device_name || HighLine.ask(I18n.t('commands.add_devices.input_device_name'))
|
|
47
|
-
device = DeployGate::Xcode::MemberCenters::Device.new(register_udid, '', register_device_name)
|
|
52
|
+
device = DeployGate::Xcode::MemberCenters::Device.new(register_udid, '', register_device_name, member_center)
|
|
48
53
|
|
|
49
54
|
puts device.to_s
|
|
50
55
|
if HighLine.agree(I18n.t('commands.add_devices.device_register_confirm')) {|q| q.default = "y"}
|
|
@@ -54,7 +59,7 @@ module DeployGate
|
|
|
54
59
|
end
|
|
55
60
|
end
|
|
56
61
|
|
|
57
|
-
build!(bundle_id, args, options)
|
|
62
|
+
build!(bundle_id, member_center, args, options)
|
|
58
63
|
end
|
|
59
64
|
|
|
60
65
|
def register!(devices)
|
|
@@ -64,18 +69,18 @@ module DeployGate
|
|
|
64
69
|
end
|
|
65
70
|
end
|
|
66
71
|
|
|
67
|
-
def build!(bundle_id, args, options)
|
|
68
|
-
app = DeployGate::Xcode::MemberCenters::App.new(bundle_id)
|
|
72
|
+
def build!(bundle_id, member_center, args, options)
|
|
73
|
+
app = DeployGate::Xcode::MemberCenters::App.new(bundle_id, member_center)
|
|
69
74
|
app.create! unless app.created?
|
|
70
75
|
|
|
71
|
-
DeployGate::Xcode::MemberCenters::ProvisioningProfile.new(bundle_id).create!
|
|
72
|
-
team =
|
|
76
|
+
DeployGate::Xcode::MemberCenters::ProvisioningProfile.new(bundle_id, member_center).create!
|
|
77
|
+
team = member_center.team
|
|
73
78
|
DeployGate::Xcode::Export.clean_provisioning_profiles(bundle_id, team)
|
|
74
79
|
|
|
75
80
|
DeployGate::Commands::Deploy::Build.run(args, options)
|
|
76
81
|
end
|
|
77
82
|
|
|
78
|
-
def fetch_devices(token, owner, bundle_id)
|
|
83
|
+
def fetch_devices(token, owner, bundle_id, member_center)
|
|
79
84
|
res = DeployGate::API::V1::Users::App.not_provisioned_udids(token, owner, bundle_id)
|
|
80
85
|
if res[:error]
|
|
81
86
|
case res[:message]
|
|
@@ -89,21 +94,11 @@ module DeployGate
|
|
|
89
94
|
end
|
|
90
95
|
|
|
91
96
|
results = res[:results]
|
|
92
|
-
devices = results.map{|r| DeployGate::Xcode::MemberCenters::Device.new(r[:udid], r[:user_name], r[:device_name])}
|
|
97
|
+
devices = results.map{|r| DeployGate::Xcode::MemberCenters::Device.new(r[:udid], r[:user_name], r[:device_name], member_center)}
|
|
93
98
|
|
|
94
99
|
devices
|
|
95
100
|
end
|
|
96
101
|
|
|
97
|
-
# @param [String] work_dir
|
|
98
|
-
# @param [String] build_configuration
|
|
99
|
-
# @return [String]
|
|
100
|
-
def bundle_id(work_dir, build_configuration)
|
|
101
|
-
root_path = DeployGate::Xcode::Ios.project_root_path(work_dir)
|
|
102
|
-
workspaces = DeployGate::Xcode::Ios.find_workspaces(root_path)
|
|
103
|
-
analyze = DeployGate::Xcode::Analyze.new(workspaces, build_configuration)
|
|
104
|
-
analyze.target_bundle_identifier
|
|
105
|
-
end
|
|
106
|
-
|
|
107
102
|
# @param [Array]
|
|
108
103
|
# @return [Array]
|
|
109
104
|
def select_devices(devices)
|
|
@@ -38,44 +38,24 @@ module DeployGate
|
|
|
38
38
|
analyze = DeployGate::Xcode::Analyze.new(workspaces, build_configuration, target_scheme)
|
|
39
39
|
target_scheme = analyze.scheme
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
# Only run Provisioning Style is Manual or nil
|
|
49
|
-
bundle_identifier = analyze.target_bundle_identifier
|
|
50
|
-
xcode_provisioning_profile_uuid = analyze.target_xcode_setting_provisioning_profile_uuid
|
|
51
|
-
provisioning_team = analyze.provisioning_team
|
|
52
|
-
target_provisioning_profile = DeployGate::Xcode::Export.provisioning_profile(
|
|
53
|
-
bundle_identifier,
|
|
54
|
-
xcode_provisioning_profile_uuid,
|
|
55
|
-
provisioning_team
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
method = DeployGate::Xcode::Export.method(target_provisioning_profile)
|
|
59
|
-
codesigning_identity = DeployGate::Xcode::Export.codesigning_identity(target_provisioning_profile)
|
|
60
|
-
|
|
61
|
-
profile = FastlaneCore::ProvisioningProfile.parse(target_provisioning_profile)
|
|
62
|
-
provisioning_profile_info = {
|
|
63
|
-
provisioningProfiles: {
|
|
64
|
-
"#{bundle_identifier}" => profile['Name']
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
else
|
|
68
|
-
method = select_method
|
|
41
|
+
code_sign_identity = nil
|
|
42
|
+
project_profile_info = nil
|
|
43
|
+
allow_provisioning_updates = true
|
|
44
|
+
if analyze.code_sign_style == Xcode::Analyze::PROVISIONING_STYLE_MANUAL
|
|
45
|
+
code_sign_identity = analyze.code_sign_identity
|
|
46
|
+
project_profile_info = analyze.project_profile_info
|
|
69
47
|
end
|
|
70
48
|
|
|
49
|
+
method = Xcode::Export.method(analyze.target_provisioning_profile) || select_method
|
|
50
|
+
|
|
71
51
|
ipa_path = DeployGate::Xcode::Ios.build(
|
|
72
52
|
analyze,
|
|
73
53
|
target_scheme,
|
|
74
|
-
|
|
75
|
-
|
|
54
|
+
code_sign_identity,
|
|
55
|
+
project_profile_info,
|
|
76
56
|
build_configuration,
|
|
77
57
|
method,
|
|
78
|
-
|
|
58
|
+
allow_provisioning_updates
|
|
79
59
|
)
|
|
80
60
|
Push.upload([ipa_path], options)
|
|
81
61
|
end
|
data/lib/deploygate/version.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module DeployGate
|
|
2
2
|
module Xcode
|
|
3
3
|
class Analyze
|
|
4
|
-
attr_reader :workspaces, :scheme_workspace, :build_workspace, :scheme
|
|
4
|
+
attr_reader :workspaces, :scheme_workspace, :build_workspace, :scheme, :xcodeproj
|
|
5
5
|
|
|
6
6
|
BASE_WORK_DIR_NAME = 'project.xcworkspace'
|
|
7
7
|
DEFAULT_BUILD_CONFIGURATION = 'Release'
|
|
@@ -23,153 +23,93 @@ module DeployGate
|
|
|
23
23
|
@build_workspace = find_build_workspace(workspaces)
|
|
24
24
|
@xcodeproj = File.dirname(@scheme_workspace)
|
|
25
25
|
|
|
26
|
-
config = FastlaneCore::Configuration.create(Gym::Options.available_options, {
|
|
27
|
-
|
|
26
|
+
config = FastlaneCore::Configuration.create(Gym::Options.available_options, { project: @xcodeproj })
|
|
27
|
+
Gym.config = config
|
|
28
|
+
@project = FastlaneCore::Project.new(config)
|
|
28
29
|
|
|
29
|
-
if project.schemes.length > 1 && target_scheme && project.schemes.include?(target_scheme)
|
|
30
|
-
project.options[:scheme] = target_scheme
|
|
30
|
+
if @project.schemes.length > 1 && target_scheme && @project.schemes.include?(target_scheme)
|
|
31
|
+
@project.options[:scheme] = target_scheme
|
|
31
32
|
else
|
|
32
|
-
project.select_scheme
|
|
33
|
+
@project.select_scheme
|
|
33
34
|
end
|
|
34
|
-
@scheme = project.options[:scheme]
|
|
35
|
+
@scheme = @project.options[:scheme]
|
|
35
36
|
end
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
product_name = target_product_name
|
|
42
|
-
product_bundle_identifier = target_build_configration.build_settings['PRODUCT_BUNDLE_IDENTIFIER']
|
|
43
|
-
product_bundle_identifier = convert_bundle_identifier(product_bundle_identifier)
|
|
44
|
-
|
|
45
|
-
info_plist_file_path = target_build_configration.build_settings['INFOPLIST_FILE']
|
|
46
|
-
root_path = DeployGate::Xcode::Ios.project_root_path(@scheme_workspace)
|
|
47
|
-
plist_bundle_identifier =
|
|
48
|
-
File.open(File.join(root_path, info_plist_file_path)) do |file|
|
|
49
|
-
plist = Plist.parse_xml file.read
|
|
50
|
-
plist['CFBundleIdentifier']
|
|
51
|
-
end
|
|
52
|
-
plist_bundle_identifier = convert_bundle_identifier(plist_bundle_identifier)
|
|
53
|
-
|
|
54
|
-
bundle_identifier = if plist_bundle_identifier.blank?
|
|
55
|
-
product_bundle_identifier
|
|
56
|
-
else
|
|
57
|
-
plist_bundle_identifier
|
|
58
|
-
end
|
|
59
|
-
bundle_identifier.gsub!(/\$\(PRODUCT_NAME:.+\)/, product_name)
|
|
60
|
-
rescue BundleIdentifierDifferentError => e
|
|
61
|
-
raise e
|
|
62
|
-
rescue => e
|
|
63
|
-
cli = HighLine.new
|
|
64
|
-
puts I18n.t('xcode.analyze.target_bundle_identifier.prompt')
|
|
65
|
-
bundle_identifier = cli.ask(I18n.t('xcode.analyze.target_bundle_identifier.ask')) { |q| q.validate = /^(\w+)\.(\w+).*\w$/ }
|
|
38
|
+
def code_sign_style
|
|
39
|
+
style = nil
|
|
40
|
+
resolve_build_configuration do |build_configuration, target|
|
|
41
|
+
style = build_configuration.resolve_build_setting("CODE_SIGN_STYLE", target)
|
|
66
42
|
end
|
|
67
43
|
|
|
68
|
-
|
|
44
|
+
style
|
|
69
45
|
end
|
|
70
46
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if custom_id == 'TARGET_NAME'
|
|
77
|
-
target_project_setting.name
|
|
78
|
-
else
|
|
79
|
-
target_build_configration.build_settings[custom_id]
|
|
80
|
-
end
|
|
81
|
-
}
|
|
82
|
-
# bail out if the result identical to the original
|
|
83
|
-
return bundle_identifier if new_bundle_identifier == bundle_identifier
|
|
47
|
+
def code_sign_identity
|
|
48
|
+
identity = nil
|
|
49
|
+
resolve_build_configuration do |build_configuration, target|
|
|
50
|
+
identity = build_configuration.resolve_build_setting("CODE_SIGN_IDENTITY", target)
|
|
51
|
+
end
|
|
84
52
|
|
|
85
|
-
|
|
53
|
+
identity
|
|
86
54
|
end
|
|
87
55
|
|
|
56
|
+
# TODO: Need to support UDID additions for watchOS and App Extension
|
|
88
57
|
# @return [String]
|
|
89
|
-
def
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
def provisioning_style
|
|
95
|
-
target = target_provisioning_info
|
|
96
|
-
build_settings = target_build_configration.build_settings
|
|
97
|
-
|
|
98
|
-
style = PROVISIONING_STYLE_MANUAL
|
|
99
|
-
if target
|
|
100
|
-
# Manual or Automatic or nil (Xcode7 below)
|
|
101
|
-
begin
|
|
102
|
-
style = target['ProvisioningStyle'] || build_settings['CODE_SIGN_STYLE']
|
|
103
|
-
rescue
|
|
104
|
-
# Not catch error
|
|
105
|
-
end
|
|
58
|
+
def target_bundle_identifier
|
|
59
|
+
bundle_identifier = nil
|
|
60
|
+
resolve_build_configuration do |build_configuration, target|
|
|
61
|
+
bundle_identifier = build_configuration.resolve_build_setting("PRODUCT_BUNDLE_IDENTIFIER", target)
|
|
106
62
|
end
|
|
107
63
|
|
|
108
|
-
|
|
64
|
+
bundle_identifier
|
|
109
65
|
end
|
|
110
66
|
|
|
111
|
-
def
|
|
112
|
-
target = target_provisioning_info
|
|
113
|
-
|
|
67
|
+
def developer_team
|
|
114
68
|
team = nil
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
team = target['DevelopmentTeam']
|
|
118
|
-
rescue
|
|
119
|
-
# Not catch error
|
|
120
|
-
end
|
|
69
|
+
resolve_build_configuration do |build_configuration, target|
|
|
70
|
+
team = build_configuration.resolve_build_setting("DEVELOPMENT_TEAM", target)
|
|
121
71
|
end
|
|
122
72
|
|
|
123
73
|
team
|
|
124
74
|
end
|
|
125
75
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
def target_provisioning_info
|
|
129
|
-
main_target = target_project_setting
|
|
130
|
-
main_target_uuid = main_target && main_target.uuid
|
|
131
|
-
|
|
132
|
-
target = nil
|
|
133
|
-
if main_target_uuid
|
|
134
|
-
begin
|
|
135
|
-
target = target_project.root_object.attributes['TargetAttributes'][main_target_uuid]
|
|
136
|
-
rescue
|
|
137
|
-
# Not catch error
|
|
138
|
-
end
|
|
139
|
-
end
|
|
76
|
+
def project_profile_info
|
|
77
|
+
gym = Gym::CodeSigningMapping.new(project: @project)
|
|
140
78
|
|
|
141
|
-
|
|
79
|
+
{
|
|
80
|
+
provisioningProfiles: gym.detect_project_profile_mapping
|
|
81
|
+
}
|
|
142
82
|
end
|
|
143
83
|
|
|
144
|
-
def
|
|
145
|
-
|
|
146
|
-
|
|
84
|
+
def target_provisioning_profile
|
|
85
|
+
gym = Gym::CodeSigningMapping.new(project: @project)
|
|
86
|
+
bundle_id = target_bundle_identifier
|
|
147
87
|
|
|
148
|
-
|
|
149
|
-
target_project_setting.product_name
|
|
88
|
+
Xcode::Export.provisioning_profile(bundle_id, nil, developer_team, gym.merge_profile_mapping[bundle_id.to_sym])
|
|
150
89
|
end
|
|
151
90
|
|
|
152
|
-
|
|
153
|
-
scheme_file = find_xcschemes
|
|
154
|
-
xs = Xcodeproj::XCScheme.new(scheme_file)
|
|
155
|
-
target_name = xs.profile_action.buildable_product_runnable.buildable_reference.target_name
|
|
91
|
+
private
|
|
156
92
|
|
|
157
|
-
|
|
158
|
-
|
|
93
|
+
def resolve_build_configuration(&block)
|
|
94
|
+
gym = Gym::CodeSigningMapping.new(project: @project)
|
|
95
|
+
specified_configuration = gym.detect_configuration_for_archive
|
|
159
96
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
97
|
+
Xcodeproj::Project.open(@xcodeproj).targets.each do |target|
|
|
98
|
+
target.build_configuration_list.build_configurations.each do |build_configuration|
|
|
99
|
+
# Used the following code as an example
|
|
100
|
+
# https://github.com/fastlane/fastlane/blob/2.148.1/gym/lib/gym/code_signing_mapping.rb#L138
|
|
101
|
+
current = build_configuration.build_settings
|
|
102
|
+
next if gym.test_target?(current)
|
|
103
|
+
sdk_root = build_configuration.resolve_build_setting("SDKROOT", target)
|
|
104
|
+
next unless gym.same_platform?(sdk_root)
|
|
105
|
+
next unless specified_configuration == build_configuration.name
|
|
163
106
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
@scheme != File.basename(scheme, '.xcscheme')
|
|
167
|
-
end
|
|
168
|
-
user_schemes = Dir[File.join(@xcodeproj, 'xcuserdata', '*.xcuserdatad', 'xcschemes', '*.xcscheme')].reject do |scheme|
|
|
169
|
-
@scheme != File.basename(scheme, '.xcscheme')
|
|
170
|
-
end
|
|
107
|
+
# If SKIP_INSTALL is true, it is an app extension or watch app
|
|
108
|
+
next if current["SKIP_INSTALL"]
|
|
171
109
|
|
|
172
|
-
|
|
110
|
+
block.call(build_configuration, target)
|
|
111
|
+
end
|
|
112
|
+
end
|
|
173
113
|
end
|
|
174
114
|
|
|
175
115
|
# @param [Array] workspaces
|
|
@@ -12,12 +12,12 @@ module DeployGate
|
|
|
12
12
|
# @param [String] uuid
|
|
13
13
|
# @param [String] provisioning_team
|
|
14
14
|
# @return [String]
|
|
15
|
-
def provisioning_profile(bundle_identifier, uuid = nil, provisioning_team = nil)
|
|
16
|
-
local_teams = DeployGate::Xcode::Export.find_local_data(bundle_identifier, uuid, provisioning_team)
|
|
15
|
+
def provisioning_profile(bundle_identifier, uuid = nil, provisioning_team = nil, specifier_name = nil)
|
|
16
|
+
local_teams = DeployGate::Xcode::Export.find_local_data(bundle_identifier, uuid, provisioning_team, specifier_name)
|
|
17
17
|
|
|
18
18
|
case local_teams.teams_count
|
|
19
19
|
when 0
|
|
20
|
-
target_provisioning_profile = create_provisioning(bundle_identifier, uuid)
|
|
20
|
+
target_provisioning_profile = create_provisioning(bundle_identifier, uuid, provisioning_team)
|
|
21
21
|
when 1
|
|
22
22
|
target_provisioning_profile = select_profile(local_teams.first_team_profile_paths)
|
|
23
23
|
else
|
|
@@ -32,12 +32,13 @@ module DeployGate
|
|
|
32
32
|
# @param [String] uuid
|
|
33
33
|
# @param [String] provisioning_team
|
|
34
34
|
# @return [LocalTeams]
|
|
35
|
-
def find_local_data(bundle_identifier, uuid = nil, provisioning_team = nil)
|
|
35
|
+
def find_local_data(bundle_identifier, uuid = nil, provisioning_team = nil, specifier_name = nil)
|
|
36
36
|
local_teams = LocalTeams.new
|
|
37
37
|
|
|
38
38
|
profile_paths = load_profile_paths
|
|
39
39
|
profiles = profile_paths.map{|p| profile_to_plist(p)}
|
|
40
40
|
profiles.reject! {|profile| profile['UUID'] != uuid} unless uuid.nil?
|
|
41
|
+
profiles.reject! {|profile| profile['Name'] != specifier_name} unless specifier_name.nil?
|
|
41
42
|
|
|
42
43
|
profiles.each do |profile|
|
|
43
44
|
next if DateTime.now >= profile['ExpirationDate'] || !installed_certificate?(profile['Path'])
|
|
@@ -79,7 +80,7 @@ module DeployGate
|
|
|
79
80
|
certificates = installed_certificates()
|
|
80
81
|
ids = []
|
|
81
82
|
certificates.each do |current|
|
|
82
|
-
next unless current.match(/iPhone Distribution:/)
|
|
83
|
+
next unless current.match(/iPhone Distribution:/) || current.match(/Apple Distribution:/)
|
|
83
84
|
begin
|
|
84
85
|
(ids << current.match(/.*\) (.*) \".*/)[1])
|
|
85
86
|
rescue
|
|
@@ -91,12 +92,12 @@ module DeployGate
|
|
|
91
92
|
end
|
|
92
93
|
|
|
93
94
|
# @return [Array]
|
|
94
|
-
def
|
|
95
|
+
def installed_distribution_conflicting_certificates_by(distribution_name)
|
|
95
96
|
certificates = installed_certificates()
|
|
96
97
|
names = []
|
|
97
98
|
certificates.each do |current|
|
|
98
99
|
begin
|
|
99
|
-
names << current.match(/(
|
|
100
|
+
names << current.match(/(#{distribution_name}:.*)/)[1]
|
|
100
101
|
rescue
|
|
101
102
|
end
|
|
102
103
|
end
|
|
@@ -105,7 +106,7 @@ module DeployGate
|
|
|
105
106
|
conflicting_certificates = []
|
|
106
107
|
certificates.each do |current|
|
|
107
108
|
begin
|
|
108
|
-
name = current.match(/(
|
|
109
|
+
name = current.match(/(#{distribution_name}:.*)/)[1]
|
|
109
110
|
next unless conflicting_names.include?(name)
|
|
110
111
|
conflicting_certificates << current
|
|
111
112
|
rescue
|
|
@@ -201,9 +202,10 @@ module DeployGate
|
|
|
201
202
|
end
|
|
202
203
|
end
|
|
203
204
|
|
|
204
|
-
def create_provisioning(identifier, uuid)
|
|
205
|
-
|
|
206
|
-
|
|
205
|
+
def create_provisioning(identifier, uuid, team_id)
|
|
206
|
+
member_center = Xcode::MemberCenter.new(team_id)
|
|
207
|
+
app = MemberCenters::App.new(identifier, member_center)
|
|
208
|
+
provisioning_prifile = MemberCenters::ProvisioningProfile.new(identifier, member_center)
|
|
207
209
|
|
|
208
210
|
begin
|
|
209
211
|
unless app.created?
|
|
@@ -253,12 +255,16 @@ module DeployGate
|
|
|
253
255
|
exit
|
|
254
256
|
end
|
|
255
257
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
+
iphone_conflicting_certificates = installed_distribution_conflicting_certificates_by('iPhone Distribution')
|
|
259
|
+
apple_conflicting_certificates = installed_distribution_conflicting_certificates_by('Apple Distribution')
|
|
260
|
+
if iphone_conflicting_certificates.count > 0 || apple_conflicting_certificates.count > 0
|
|
258
261
|
puts HighLine.color(I18n.t('xcode.export.check_local_certificates.conflict_certificate.error_message'), HighLine::RED)
|
|
259
262
|
puts ''
|
|
260
263
|
puts I18n.t('xcode.export.check_local_certificates.conflict_certificate.note')
|
|
261
|
-
|
|
264
|
+
iphone_conflicting_certificates.each do |certificate|
|
|
265
|
+
puts certificate
|
|
266
|
+
end
|
|
267
|
+
apple_conflicting_certificates.each do |certificate|
|
|
262
268
|
puts certificate
|
|
263
269
|
end
|
|
264
270
|
puts ""
|
data/lib/deploygate/xcode/ios.rb
CHANGED
|
@@ -28,10 +28,16 @@ module DeployGate
|
|
|
28
28
|
|
|
29
29
|
values = {
|
|
30
30
|
export_method: export_method,
|
|
31
|
-
workspace: ios_analyze.build_workspace,
|
|
32
31
|
configuration: build_configuration || DeployGate::Xcode::Analyze::DEFAULT_BUILD_CONFIGURATION,
|
|
33
32
|
scheme: target_scheme
|
|
34
33
|
}
|
|
34
|
+
|
|
35
|
+
if ios_analyze.build_workspace
|
|
36
|
+
values[:workspace] = ios_analyze.build_workspace
|
|
37
|
+
else
|
|
38
|
+
values[:project] = ios_analyze.xcodeproj
|
|
39
|
+
end
|
|
40
|
+
|
|
35
41
|
values[:codesigning_identity] = codesigning_identity if codesigning_identity
|
|
36
42
|
if allow_provisioning_updates
|
|
37
43
|
values[:xcargs] = '-allowProvisioningUpdates'
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
require 'singleton'
|
|
2
|
-
|
|
3
1
|
module DeployGate
|
|
4
2
|
module Xcode
|
|
5
3
|
class MemberCenter
|
|
6
|
-
include Singleton
|
|
7
4
|
attr_reader :email, :method, :team, :launcher
|
|
8
5
|
|
|
9
|
-
def initialize
|
|
6
|
+
def initialize(team_id)
|
|
10
7
|
@email = input_email
|
|
11
8
|
@launcher = Spaceship::Launcher.new @email
|
|
12
|
-
@team = @launcher.select_team
|
|
9
|
+
@team = @launcher.select_team(team_id: team_id)
|
|
13
10
|
|
|
14
11
|
if @launcher.client.in_house?
|
|
15
12
|
@method = Export::ENTERPRISE
|
|
@@ -5,9 +5,10 @@ module DeployGate
|
|
|
5
5
|
attr_reader :uuid, :member_center
|
|
6
6
|
|
|
7
7
|
# @param [String] uuid
|
|
8
|
+
# @param [Xcode::MemberCenter] member_center
|
|
8
9
|
# @return [DeployGate::Xcode::MemberCenters::App]
|
|
9
|
-
def initialize(uuid)
|
|
10
|
-
@member_center =
|
|
10
|
+
def initialize(uuid, member_center)
|
|
11
|
+
@member_center = member_center
|
|
11
12
|
@uuid = uuid
|
|
12
13
|
end
|
|
13
14
|
|
|
@@ -5,29 +5,31 @@ module DeployGate
|
|
|
5
5
|
attr_reader :udid, :user_name ,:device_name, :member_center
|
|
6
6
|
attr_accessor :register_name
|
|
7
7
|
|
|
8
|
+
REGISTER_NAME_MAX_LENGTH = 50
|
|
9
|
+
|
|
8
10
|
# @param [String] udid
|
|
9
11
|
# @param [String] user_name
|
|
10
12
|
# @param [String] device_name
|
|
13
|
+
# @param [Xcode::MemberCenter] member_center
|
|
11
14
|
# @return [DeployGate::Devices::Ios]
|
|
12
|
-
def initialize(udid, user_name, device_name)
|
|
15
|
+
def initialize(udid, user_name, device_name, member_center)
|
|
13
16
|
@udid = udid
|
|
14
17
|
@user_name = user_name
|
|
15
18
|
@device_name = device_name
|
|
19
|
+
@member_center = member_center
|
|
16
20
|
|
|
17
21
|
@register_name = generate_register_name(@user_name, @device_name)
|
|
18
22
|
end
|
|
19
23
|
|
|
20
24
|
def registered?
|
|
21
|
-
|
|
22
|
-
!instance.launcher.device.find_by_udid(@udid).nil?
|
|
25
|
+
!@member_center.launcher.device.find_by_udid(@udid).nil?
|
|
23
26
|
end
|
|
24
27
|
|
|
25
28
|
# @return [void]
|
|
26
29
|
def register!
|
|
27
|
-
instance = DeployGate::Xcode::MemberCenter.instance
|
|
28
30
|
return if registered?
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
@member_center.launcher.device.create!(name: @register_name, udid: @udid)
|
|
31
33
|
end
|
|
32
34
|
|
|
33
35
|
# @return [String]
|
|
@@ -42,7 +44,13 @@ module DeployGate
|
|
|
42
44
|
name += "#{user_name} - " if !user_name.nil? && user_name != ''
|
|
43
45
|
name += device_name
|
|
44
46
|
|
|
45
|
-
name
|
|
47
|
+
register_name_trim(name)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Device name must be 50 characters or less.
|
|
51
|
+
def register_name_trim(name)
|
|
52
|
+
return name if name.length <= REGISTER_NAME_MAX_LENGTH
|
|
53
|
+
name.slice(0, REGISTER_NAME_MAX_LENGTH)
|
|
46
54
|
end
|
|
47
55
|
end
|
|
48
56
|
end
|
|
@@ -12,8 +12,8 @@ module DeployGate
|
|
|
12
12
|
OUTPUT_PATH = '/tmp/dg/provisioning_profile/'
|
|
13
13
|
CERTIFICATE_OUTPUT_PATH = '/tmp/dg/certificate/'
|
|
14
14
|
|
|
15
|
-
def initialize(app_identifier)
|
|
16
|
-
@member_center =
|
|
15
|
+
def initialize(app_identifier, member_center)
|
|
16
|
+
@member_center = member_center
|
|
17
17
|
@app_identifier = app_identifier
|
|
18
18
|
|
|
19
19
|
FileUtils.mkdir_p(OUTPUT_PATH)
|
|
@@ -35,16 +35,22 @@ module DeployGate
|
|
|
35
35
|
|
|
36
36
|
# @return [Array]
|
|
37
37
|
def all_create
|
|
38
|
-
if @member_center.adhoc?
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
prod_certs = if @member_center.adhoc?
|
|
39
|
+
@member_center.launcher.certificate.all.select{|cert|
|
|
40
|
+
cert.class == Spaceship::Portal::Certificate::Production ||
|
|
41
|
+
cert.class == Spaceship::Portal::Certificate::AppleDistribution
|
|
42
|
+
}
|
|
43
|
+
else
|
|
44
|
+
@member_center.launcher.certificate.all.select{|cert|
|
|
45
|
+
cert.class == Spaceship::Portal::Certificate::InHouse
|
|
46
|
+
}
|
|
47
|
+
end
|
|
43
48
|
|
|
44
49
|
# check local install certificate
|
|
45
50
|
FileUtils.mkdir_p(CERTIFICATE_OUTPUT_PATH)
|
|
46
51
|
distribution_cert_ids = []
|
|
47
52
|
prod_certs.each do |cert|
|
|
53
|
+
next if cert.expires < Time.now
|
|
48
54
|
path = File.join(CERTIFICATE_OUTPUT_PATH, "#{cert.id}.cer")
|
|
49
55
|
raw_data = cert.download_raw
|
|
50
56
|
File.write(path, raw_data)
|
|
@@ -1,59 +1,2 @@
|
|
|
1
1
|
describe DeployGate::Xcode::Analyze do
|
|
2
|
-
|
|
3
|
-
context '#convert_bundle_identifier' do
|
|
4
|
-
|
|
5
|
-
class DummyProject
|
|
6
|
-
SCHEME = 'dummy'
|
|
7
|
-
def schemes
|
|
8
|
-
[SCHEME, 'dummy2']
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def options
|
|
12
|
-
{}
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
class DummyProjectSetting
|
|
17
|
-
def name
|
|
18
|
-
'TargetName'
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
class DummyBuildConfigration
|
|
23
|
-
def build_settings
|
|
24
|
-
{
|
|
25
|
-
'PRODUCT_NAME' => '$(TARGET_NAME)',
|
|
26
|
-
'CUSTOM_KEY' => 'CustomKey',
|
|
27
|
-
'PRODUCT_BUNDLE_IDENTIFER' => 'com.deploygate.app',
|
|
28
|
-
'DEBUG_POSTFIX' => '.debug',
|
|
29
|
-
'LOOP' => '$(LOOP)'
|
|
30
|
-
}
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
before do
|
|
35
|
-
allow_any_instance_of(DeployGate::Xcode::Analyze).to receive(:find_scheme_workspace).and_return('')
|
|
36
|
-
allow_any_instance_of(DeployGate::Xcode::Analyze).to receive(:find_build_workspace)
|
|
37
|
-
allow_any_instance_of(DeployGate::Xcode::Analyze).to receive(:target_build_configration).and_return(DummyBuildConfigration.new)
|
|
38
|
-
allow_any_instance_of(DeployGate::Xcode::Analyze).to receive(:target_project_setting).and_return(DummyProjectSetting.new)
|
|
39
|
-
allow(FastlaneCore::Configuration).to receive(:create)
|
|
40
|
-
allow(FastlaneCore::Project).to receive(:new).and_return(DummyProject.new)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
it do
|
|
44
|
-
analyze = DeployGate::Xcode::Analyze.new('', nil, DummyProject::SCHEME)
|
|
45
|
-
expect(analyze.convert_bundle_identifier('com.deploygate.$(PRODUCT_NAME).${CUSTOM_KEY}')).to eq 'com.deploygate.TargetName.CustomKey'
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
it 'if only env' do
|
|
49
|
-
analyze = DeployGate::Xcode::Analyze.new('', nil, DummyProject::SCHEME)
|
|
50
|
-
expect(analyze.convert_bundle_identifier('$(PRODUCT_BUNDLE_IDENTIFER)$(DEBUG_POSTFIX)')).to eq 'com.deploygate.app.debug'
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it 'if loop env' do
|
|
54
|
-
analyze = DeployGate::Xcode::Analyze.new('', nil, DummyProject::SCHEME)
|
|
55
|
-
expect(analyze.convert_bundle_identifier('$(LOOP)')).to eq '$(LOOP)'
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
2
|
end
|
|
@@ -61,6 +61,7 @@ describe DeployGate::Xcode::Export do
|
|
|
61
61
|
before do
|
|
62
62
|
@distribution_certificate_id = 'distribution_certificate_id'
|
|
63
63
|
@distribution_certificate = " 1) #{@distribution_certificate_id} \"iPhone Distribution: DeployGate Inc.\""
|
|
64
|
+
@apple_distribution_certificate = " 1) #{@distribution_certificate_id} \"Apple Distribution: DeployGate Inc.\""
|
|
64
65
|
@not_distribution_certificate = " 1) xxxxxxxxxxxxxx \"iPhone Developer: DeployGate Inc.\""
|
|
65
66
|
end
|
|
66
67
|
it "not installed distribution certificate" do
|
|
@@ -74,23 +75,44 @@ describe DeployGate::Xcode::Export do
|
|
|
74
75
|
ids = DeployGate::Xcode::Export.installed_distribution_certificate_ids
|
|
75
76
|
expect(ids).to eql([@distribution_certificate_id])
|
|
76
77
|
end
|
|
78
|
+
|
|
79
|
+
it "installed apple distribution certificate" do
|
|
80
|
+
allow(DeployGate::Xcode::Export).to receive(:installed_certificates).and_return([@apple_distribution_certificate, @not_distribution_certificate])
|
|
81
|
+
|
|
82
|
+
ids = DeployGate::Xcode::Export.installed_distribution_certificate_ids
|
|
83
|
+
expect(ids).to eql([@distribution_certificate_id])
|
|
84
|
+
end
|
|
77
85
|
end
|
|
78
86
|
|
|
79
|
-
describe "#
|
|
87
|
+
describe "#installed_distribution_conflicting_certificates_by" do
|
|
80
88
|
before do
|
|
81
89
|
@distribution_certificate = " 1) xxxxxxxxxx \"iPhone Distribution: DeployGate Inc.\""
|
|
82
90
|
@distribution_certificate2 = " 2) yyyyyyyyyyyy \"iPhone Distribution: DeployGate Inc.\""
|
|
83
91
|
@distribution_certificate3 = " 2) yyyyyyyyyyyy \"iPhone Distribution: DeployGate Inc2.\""
|
|
92
|
+
|
|
93
|
+
@apple_distribution_certificate = " 1) xxxxxxxxxxx \"Apple Distribution: DeployGate Inc.\""
|
|
94
|
+
@apple_distribution_certificate2 = " 2) yyyyyyyyyyyy \"Apple Distribution: DeployGate Inc.\""
|
|
95
|
+
@apple_distribution_certificate3 = " 2) yyyyyyyyyyyy \"Apple Distribution: DeployGate Inc2.\""
|
|
84
96
|
end
|
|
85
97
|
|
|
86
98
|
it "conflicting" do
|
|
87
99
|
allow(DeployGate::Xcode::Export).to receive(:installed_certificates).and_return([@distribution_certificate, @distribution_certificate2])
|
|
88
|
-
expect(DeployGate::Xcode::Export.
|
|
100
|
+
expect(DeployGate::Xcode::Export.installed_distribution_conflicting_certificates_by('iPhone Distribution').count).to eql 2
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
it "conflicting by apple" do
|
|
104
|
+
allow(DeployGate::Xcode::Export).to receive(:installed_certificates).and_return([@apple_distribution_certificate, @apple_distribution_certificate2])
|
|
105
|
+
expect(DeployGate::Xcode::Export.installed_distribution_conflicting_certificates_by('Apple Distribution').count).to eql 2
|
|
89
106
|
end
|
|
90
107
|
|
|
91
108
|
it "not conflicting" do
|
|
92
109
|
allow(DeployGate::Xcode::Export).to receive(:installed_certificates).and_return([@distribution_certificate, @distribution_certificate3])
|
|
93
|
-
expect(DeployGate::Xcode::Export.
|
|
110
|
+
expect(DeployGate::Xcode::Export.installed_distribution_conflicting_certificates_by('iPhone Distribution').count).to eql 0
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
it "not conflicting by apple" do
|
|
114
|
+
allow(DeployGate::Xcode::Export).to receive(:installed_certificates).and_return([@apple_distribution_certificate, @apple_distribution_certificate3])
|
|
115
|
+
expect(DeployGate::Xcode::Export.installed_distribution_conflicting_certificates_by('Apple Distribution').count).to eql 0
|
|
94
116
|
end
|
|
95
117
|
end
|
|
96
118
|
end
|
|
@@ -5,7 +5,7 @@ describe DeployGate::Xcode::MemberCenter do
|
|
|
5
5
|
end
|
|
6
6
|
|
|
7
7
|
let(:email) { 'test@example.com' }
|
|
8
|
-
let(:center) { DeployGate::Xcode::MemberCenter.
|
|
8
|
+
let(:center) { DeployGate::Xcode::MemberCenter.new('com-example-team-id') }
|
|
9
9
|
before do
|
|
10
10
|
allow_any_instance_of(Spaceship::PortalClient).to receive(:login) {}
|
|
11
11
|
allow_any_instance_of(Spaceship::PortalClient).to receive(:teams) {['team_name', 'team_id']}
|
|
@@ -2,7 +2,8 @@ describe DeployGate::Xcode::MemberCenters::App do
|
|
|
2
2
|
let(:email) { 'test@example.com' }
|
|
3
3
|
let(:registered_uuid) { 'com.example.test.registered' }
|
|
4
4
|
let(:non_registered_uuid) { 'com.example.test.non.registered' }
|
|
5
|
-
let(:
|
|
5
|
+
let(:member_center) { DeployGate::Xcode::MemberCenter.new('com-example-team-id') }
|
|
6
|
+
let(:app) { DeployGate::Xcode::MemberCenters::App.new('com.example.test.new.app', member_center) }
|
|
6
7
|
|
|
7
8
|
before do
|
|
8
9
|
allow_any_instance_of(Spaceship::PortalClient).to receive(:login) {}
|
|
@@ -18,13 +19,13 @@ describe DeployGate::Xcode::MemberCenters::App do
|
|
|
18
19
|
context "#created?" do
|
|
19
20
|
|
|
20
21
|
it "app created" do
|
|
21
|
-
app = DeployGate::Xcode::MemberCenters::App.new(registered_uuid)
|
|
22
|
+
app = DeployGate::Xcode::MemberCenters::App.new(registered_uuid, member_center)
|
|
22
23
|
|
|
23
24
|
expect(app.created?).to be_truthy
|
|
24
25
|
end
|
|
25
26
|
|
|
26
27
|
it "no app created" do
|
|
27
|
-
app = DeployGate::Xcode::MemberCenters::App.new(non_registered_uuid)
|
|
28
|
+
app = DeployGate::Xcode::MemberCenters::App.new(non_registered_uuid, member_center)
|
|
28
29
|
|
|
29
30
|
expect(app.created?).to be_falsey
|
|
30
31
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: deploygate
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- deploygate
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-10-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: json
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
19
|
+
version: '2.0'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
26
|
+
version: '2.0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: httpclient
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -240,28 +240,34 @@ dependencies:
|
|
|
240
240
|
requirements:
|
|
241
241
|
- - "~>"
|
|
242
242
|
- !ruby/object:Gem::Version
|
|
243
|
-
version: 2.
|
|
243
|
+
version: 2.148.1
|
|
244
244
|
type: :runtime
|
|
245
245
|
prerelease: false
|
|
246
246
|
version_requirements: !ruby/object:Gem::Requirement
|
|
247
247
|
requirements:
|
|
248
248
|
- - "~>"
|
|
249
249
|
- !ruby/object:Gem::Version
|
|
250
|
-
version: 2.
|
|
250
|
+
version: 2.148.1
|
|
251
251
|
- !ruby/object:Gem::Dependency
|
|
252
252
|
name: bundler
|
|
253
253
|
requirement: !ruby/object:Gem::Requirement
|
|
254
254
|
requirements:
|
|
255
|
-
- - "
|
|
255
|
+
- - ">="
|
|
256
256
|
- !ruby/object:Gem::Version
|
|
257
|
-
version:
|
|
257
|
+
version: 2.1.4
|
|
258
|
+
- - "<"
|
|
259
|
+
- !ruby/object:Gem::Version
|
|
260
|
+
version: '3.0'
|
|
258
261
|
type: :development
|
|
259
262
|
prerelease: false
|
|
260
263
|
version_requirements: !ruby/object:Gem::Requirement
|
|
261
264
|
requirements:
|
|
262
|
-
- - "
|
|
265
|
+
- - ">="
|
|
266
|
+
- !ruby/object:Gem::Version
|
|
267
|
+
version: 2.1.4
|
|
268
|
+
- - "<"
|
|
263
269
|
- !ruby/object:Gem::Version
|
|
264
|
-
version: '
|
|
270
|
+
version: '3.0'
|
|
265
271
|
- !ruby/object:Gem::Dependency
|
|
266
272
|
name: rake
|
|
267
273
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -418,7 +424,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
418
424
|
- !ruby/object:Gem::Version
|
|
419
425
|
version: '0'
|
|
420
426
|
requirements: []
|
|
421
|
-
rubygems_version: 3.0.
|
|
427
|
+
rubygems_version: 3.0.8
|
|
422
428
|
signing_key:
|
|
423
429
|
specification_version: 4
|
|
424
430
|
summary: A command-line interface for DeployGate
|