deploygate 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +6 -2
- data/README.md +9 -2
- data/config/locales/en.yml +0 -6
- data/deploygate.gemspec +3 -3
- data/lib/deploygate/add_devices_server.rb +6 -7
- data/lib/deploygate/command_builder.rb +2 -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 +46 -116
- data/lib/deploygate/xcode/export.rb +9 -7
- data/lib/deploygate/xcode/ios.rb +1 -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 +2 -2
- data/spec/deploygate/xcode/analyze_spec.rb +0 -57
- 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 +18 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 240a15ab59a4c7bbf4a9eaddea45753f1e0c43b043d7dd13da404567034e8b97
|
4
|
+
data.tar.gz: f4e49f23e2e26a96c26d44e6cc499260494f6540b13e4cebd9a108b0e93e1e79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74c6ec9d1a2fc12a27f722a336e5e2438481644d2c4eec1740001c07ede7c1733739a51bebf0bec034a3a7e2aca88ecd2e2665c28fcca277a363af0e646086ba
|
7
|
+
data.tar.gz: ebbd48822b79e23fd0098377fa09254f5cd46a3244f08c817a942db381cc2080434f0e77c403caae9875ce1f59c0b27b7631cd5dbed7ac28d4720840e1420121
|
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:
|
data/README.md
CHANGED
@@ -1,8 +1,15 @@
|
|
1
1
|
# deploygate-cli
|
2
|
+
|
2
3
|
[![Gem Version](https://badge.fury.io/rb/deploygate.svg)](https://badge.fury.io/rb/deploygate)
|
3
4
|
[![Build Status](https://travis-ci.org/DeployGate/deploygate-cli.svg?branch=master)](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
@@ -157,12 +157,6 @@ en:
|
|
157
157
|
start: 'Cleaning local Provisioning Profiles...'
|
158
158
|
delete: 'Delete %{path}'
|
159
159
|
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
160
|
ios:
|
167
161
|
build:
|
168
162
|
error:
|
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'
|
@@ -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
|
@@ -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,
|
@@ -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,83 @@ 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
|
+
# Support Xcode7 more
|
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
|
76
|
+
def project_profile_info
|
77
|
+
gym = Gym::CodeSigningMapping.new(project: @project)
|
131
78
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
target = target_project.root_object.attributes['TargetAttributes'][main_target_uuid]
|
136
|
-
rescue
|
137
|
-
# Not catch error
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
target
|
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
|
156
|
-
|
157
|
-
target_project.native_targets.reject{|target| target.name != target_name}.first
|
158
|
-
end
|
91
|
+
private
|
159
92
|
|
160
|
-
def
|
161
|
-
|
162
|
-
|
93
|
+
def resolve_build_configuration(&block)
|
94
|
+
gym = Gym::CodeSigningMapping.new(project: @project)
|
95
|
+
specified_configuration = gym.detect_configuration_for_archive
|
163
96
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
@scheme != File.basename(scheme, '.xcscheme')
|
97
|
+
Xcodeproj::Project.open(@xcodeproj).targets.each do |target|
|
98
|
+
target.build_configuration_list.build_configurations.each do |build_configuration|
|
99
|
+
next if build_configuration.name != specified_configuration
|
100
|
+
block.call(build_configuration, target)
|
101
|
+
end
|
170
102
|
end
|
171
|
-
|
172
|
-
shared_schemes.concat(user_schemes).first
|
173
103
|
end
|
174
104
|
|
175
105
|
# @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'])
|
@@ -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?
|
data/lib/deploygate/xcode/ios.rb
CHANGED
@@ -28,7 +28,7 @@ module DeployGate
|
|
28
28
|
|
29
29
|
values = {
|
30
30
|
export_method: export_method,
|
31
|
-
|
31
|
+
project: ios_analyze.xcodeproj,
|
32
32
|
configuration: build_configuration || DeployGate::Xcode::Analyze::DEFAULT_BUILD_CONFIGURATION,
|
33
33
|
scheme: target_scheme
|
34
34
|
}
|
@@ -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)
|
@@ -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
|
@@ -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.0
|
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-05-21 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:
|
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:
|
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,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
418
424
|
- !ruby/object:Gem::Version
|
419
425
|
version: '0'
|
420
426
|
requirements: []
|
421
|
-
|
427
|
+
rubyforge_project:
|
428
|
+
rubygems_version: 2.7.7
|
422
429
|
signing_key:
|
423
430
|
specification_version: 4
|
424
431
|
summary: A command-line interface for DeployGate
|