sigh 0.3.3 → 0.3.4
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/README.md +16 -7
- data/bin/sigh +2 -1
- data/lib/sigh/developer_center.rb +22 -13
- data/lib/sigh/developer_center_signing.rb +88 -0
- data/lib/sigh/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f42e282f190c126b2e2698b8294f64ead5b52ba
|
4
|
+
data.tar.gz: 77fc2e97b0a314183bd0cfdc7ba537f866dfbe01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2b4dff8c89d996764cb0a28f105c6a4f48c91a2b78b1307463b21842a4b0b7bb895ed1a9a660573733118d3cfe28e767cfb3d21e8d4e54cd744587a0a2c4322
|
7
|
+
data.tar.gz: e6fcf9e4b4a32d8e0905ad46a844c150c3387e8b6449d8491ab8314d4d53bce796adb07a40345468f57fbe62ddab052aaafff889ac9ae64050914d8b24d55c4b
|
data/README.md
CHANGED
@@ -11,7 +11,8 @@
|
|
11
11
|
<a href="https://github.com/KrauseFx/frameit">frameit</a> •
|
12
12
|
<a href="https://github.com/KrauseFx/PEM">PEM</a> •
|
13
13
|
<b>sigh</b> •
|
14
|
-
<a href="https://github.com/KrauseFx/produce">produce</a>
|
14
|
+
<a href="https://github.com/KrauseFx/produce">produce</a> •
|
15
|
+
<a href="https://github.com/KrauseFx/cert">cert</a>
|
15
16
|
</p>
|
16
17
|
-------
|
17
18
|
|
@@ -116,9 +117,9 @@ To save the provisioning profile under a specific name, use the -f option:
|
|
116
117
|
|
117
118
|
sigh -a com.krausefx.app -u username -f "myProfile.mobileprovision"
|
118
119
|
|
119
|
-
If you need the provisioning profile to be renewed regardless of its state use the `--force` option. This gives you a profile with the maximum lifetime
|
120
|
+
If you need the provisioning profile to be renewed regardless of its state use the `--force` option. This gives you a profile with the maximum lifetime. `--force` will also add all available devices to this profile.
|
120
121
|
|
121
|
-
sigh --force
|
122
|
+
sigh --force
|
122
123
|
|
123
124
|
By default, ```sigh``` will include all certificates on development profiles, and first certificate on other types. If you need to specify which certificate to use you can either use the environment variable `SIGH_CERTIFICATE`, or pass the name or expiry date of the certificate as argument:
|
124
125
|
|
@@ -144,12 +145,19 @@ You can pass more information using the command line:
|
|
144
145
|
## Environment Variables
|
145
146
|
In case you prefer environment variables:
|
146
147
|
|
147
|
-
-
|
148
|
-
-
|
149
|
-
-
|
150
|
-
- ```SIGH_TEAM_ID``` (The Team ID, e.g. `Q2CBPK58CA`)
|
148
|
+
- `SIGH_USERNAME`
|
149
|
+
- `SIGH_APP_IDENTIFIER`
|
150
|
+
- `SIGH_TEAM_ID` (The Team ID, e.g. `Q2CBPK58CA`)
|
151
151
|
- `SIGH_DISABLE_OPEN_ERROR` - in case of error, `sigh` won't open Preview with a screenshot of the error when this variable is set.
|
152
152
|
|
153
|
+
Choose signing certificate to use:
|
154
|
+
|
155
|
+
- `SIGH_CERTIFICATE` (The name of the certificate to use)
|
156
|
+
- `SIGH_CERTIFICATE_ID` (The ID of the certificate)
|
157
|
+
- `SIGH_CERTIFICATE_EXPIRE_DATE` (The expire date of the certificate)
|
158
|
+
|
159
|
+
If you're using [cert](https://github.com/KrauseFx/cert) in combination with [fastlane](https://github.com/KrauseFx/fastlane) the signing certificate will automatically be selected for you.
|
160
|
+
|
153
161
|
# How does it work?
|
154
162
|
|
155
163
|
```sigh``` will access the ```iOS Dev Center``` to download, renew or generate the ```.mobileprovision``` file. Check out the full source code: [developer_center.rb](https://github.com/KrauseFx/sigh/blob/master/lib/sigh/developer_center.rb).
|
@@ -167,6 +175,7 @@ In case you prefer environment variables:
|
|
167
175
|
- [`frameit`](https://github.com/KrauseFx/frameit): Quickly put your screenshots into the right device frames
|
168
176
|
- [`PEM`](https://github.com/KrauseFx/pem): Automatically generate and renew your push notification profiles
|
169
177
|
- [`produce`](https://github.com/KrauseFx/produce): Create new iOS apps on iTunes Connect and Dev Portal using the command line
|
178
|
+
- [`cert`](https://github.com/KrauseFx/cert): Automatically create and maintain iOS code signing certificates
|
170
179
|
|
171
180
|
## Use the 'Provisioning Quicklook plugin'
|
172
181
|
Download and install the [Provisioning Plugin](https://github.com/chockenberry/Provisioning).
|
data/bin/sigh
CHANGED
@@ -48,8 +48,9 @@ class SighApplication
|
|
48
48
|
type = FastlaneCore::DeveloperCenter::DEVELOPMENT if options.development
|
49
49
|
|
50
50
|
ENV['SIGH_CERTIFICATE'] = options.cert_owner if options.cert_owner
|
51
|
+
ENV['SIGH_CERTIFICATE_EXPIRE_DATE'] = options.cert_date if options.cert_date
|
51
52
|
|
52
|
-
path = FastlaneCore::DeveloperCenter.new.run(app, type, options.cert_name, options.force
|
53
|
+
path = FastlaneCore::DeveloperCenter.new.run(app, type, options.cert_name, options.force)
|
53
54
|
|
54
55
|
if path
|
55
56
|
file_name = options.filename || File.basename(path)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'fastlane_core/developer_center/developer_center'
|
2
|
+
require 'sigh/developer_center_signing'
|
2
3
|
|
3
4
|
module FastlaneCore
|
4
5
|
class DeveloperCenter
|
@@ -10,8 +11,8 @@ module FastlaneCore
|
|
10
11
|
PROFILES_URL_DEV = "https://developer.apple.com/account/ios/profile/profileList.action?type=limited"
|
11
12
|
|
12
13
|
|
13
|
-
def run(app_identifier, type, cert_name = nil, force = false
|
14
|
-
cert = maintain_app_certificate(app_identifier, type, force
|
14
|
+
def run(app_identifier, type, cert_name = nil, force = false)
|
15
|
+
cert = maintain_app_certificate(app_identifier, type, force)
|
15
16
|
|
16
17
|
type_name = type
|
17
18
|
type_name = "Distribution" if type == APPSTORE # both enterprise and App Store
|
@@ -24,7 +25,7 @@ module FastlaneCore
|
|
24
25
|
return output_path
|
25
26
|
end
|
26
27
|
|
27
|
-
def maintain_app_certificate(app_identifier, type, force
|
28
|
+
def maintain_app_certificate(app_identifier, type, force)
|
28
29
|
begin
|
29
30
|
if type == DEVELOPMENT
|
30
31
|
visit PROFILES_URL_DEV
|
@@ -55,13 +56,13 @@ module FastlaneCore
|
|
55
56
|
# We found the correct certificate
|
56
57
|
if force && type != DEVELOPMENT
|
57
58
|
provisioningProfileId = current_cert['provisioningProfileId']
|
58
|
-
renew_profile(provisioningProfileId, type
|
59
|
-
return maintain_app_certificate(app_identifier, type, false
|
59
|
+
renew_profile(provisioningProfileId, type) # This one needs to be forcefully renewed
|
60
|
+
return maintain_app_certificate(app_identifier, type, false) # recursive
|
60
61
|
elsif current_cert['status'] == 'Active'
|
61
62
|
return download_profile(details['provisioningProfile']['provisioningProfileId']) # this one is already finished. Just download it.
|
62
63
|
elsif ['Expired', 'Invalid'].include? current_cert['status']
|
63
|
-
renew_profile(current_cert['provisioningProfileId'], type
|
64
|
-
return maintain_app_certificate(app_identifier, type, false
|
64
|
+
renew_profile(current_cert['provisioningProfileId'], type) # This one needs to be renewed
|
65
|
+
return maintain_app_certificate(app_identifier, type, false) # recursive
|
65
66
|
end
|
66
67
|
|
67
68
|
break
|
@@ -70,18 +71,18 @@ module FastlaneCore
|
|
70
71
|
|
71
72
|
Helper.log.info "Could not find existing profile. Trying to create a new one."
|
72
73
|
# Certificate does not exist yet, we need to create a new one
|
73
|
-
create_profile(app_identifier, type
|
74
|
+
create_profile(app_identifier, type)
|
74
75
|
# After creating the profile, we need to download it
|
75
|
-
return maintain_app_certificate(app_identifier, type, false
|
76
|
+
return maintain_app_certificate(app_identifier, type, false) # recursive
|
76
77
|
|
77
78
|
rescue => ex
|
78
79
|
error_occured(ex)
|
79
80
|
end
|
80
81
|
end
|
81
82
|
|
82
|
-
def create_profile(app_identifier, type
|
83
|
+
def create_profile(app_identifier, type)
|
83
84
|
Helper.log.info "Creating new profile for app '#{app_identifier}' for type '#{type}'.".yellow
|
84
|
-
certificates = code_signing_certificates(type
|
85
|
+
certificates = code_signing_certificates(type)
|
85
86
|
|
86
87
|
create_url = "https://developer.apple.com/account/ios/profile/profileCreate.action"
|
87
88
|
visit create_url
|
@@ -164,8 +165,8 @@ module FastlaneCore
|
|
164
165
|
wait_for_elements('.row-details')
|
165
166
|
end
|
166
167
|
|
167
|
-
def renew_profile(profile_id, type
|
168
|
-
certificate = code_signing_certificates(type
|
168
|
+
def renew_profile(profile_id, type)
|
169
|
+
certificate = code_signing_certificates(type).first
|
169
170
|
|
170
171
|
details_url = "https://developer.apple.com/account/ios/profile/profileEdit.action?type=&provisioningProfileId=#{profile_id}"
|
171
172
|
Helper.log.info "Renewing provisioning profile '#{profile_id}' using URL '#{details_url}'"
|
@@ -177,6 +178,14 @@ module FastlaneCore
|
|
177
178
|
certs = all(:xpath, "//input[@type='radio' and @value='#{certificate["certificateId"]}']")
|
178
179
|
if certs.count == 1
|
179
180
|
certs.first.click
|
181
|
+
|
182
|
+
if type != APPSTORE
|
183
|
+
# Add all devices
|
184
|
+
wait_for_elements('.selectAll.column')
|
185
|
+
sleep 3
|
186
|
+
first(:xpath, "//div[@class='selectAll column']/input").click # select all the devices
|
187
|
+
end
|
188
|
+
|
180
189
|
click_next
|
181
190
|
|
182
191
|
wait_for_elements('.row-details')
|
@@ -0,0 +1,88 @@
|
|
1
|
+
module FastlaneCore
|
2
|
+
class DeveloperCenter
|
3
|
+
# Returns a array of hashes, that contains information about the iOS certificate
|
4
|
+
# @example
|
5
|
+
# [{"certRequestId"=>"B23Q2P396B",
|
6
|
+
# "name"=>"SunApps GmbH",
|
7
|
+
# "statusString"=>"Issued",
|
8
|
+
# "expirationDate"=>"2015-11-25T22:45:50Z",
|
9
|
+
# "expirationDateString"=>"Nov 25, 2015",
|
10
|
+
# "ownerType"=>"team",
|
11
|
+
# "ownerName"=>"SunApps GmbH",
|
12
|
+
# "ownerId"=>"....",
|
13
|
+
# "canDownload"=>true,
|
14
|
+
# "canRevoke"=>true,
|
15
|
+
# "certificateId"=>"....",
|
16
|
+
# "certificateStatusCode"=>0,
|
17
|
+
# "certRequestStatusCode"=>4,
|
18
|
+
# "certificateTypeDisplayId"=>"...",
|
19
|
+
# "serialNum"=>"....",
|
20
|
+
# "typeString"=>"iOS Distribution"},
|
21
|
+
# {another sertificate...}]
|
22
|
+
def code_signing_certificates(type)
|
23
|
+
certs_url = "https://developer.apple.com/account/ios/certificate/certificateList.action?type="
|
24
|
+
certs_url << (type == DEVELOPMENT ? 'development' : 'distribution')
|
25
|
+
visit certs_url
|
26
|
+
|
27
|
+
certificateDataURL = wait_for_variable('certificateDataURL')
|
28
|
+
certificateRequestTypes = wait_for_variable('certificateRequestTypes')
|
29
|
+
certificateStatuses = wait_for_variable('certificateStatuses')
|
30
|
+
|
31
|
+
url = [certificateDataURL, certificateRequestTypes, certificateStatuses].join('')
|
32
|
+
|
33
|
+
# https://developer.apple.com/services-account/.../account/ios/certificate/listCertRequests.action?content-type=application/x-www-form-urlencoded&accept=application/json&requestId=...&userLocale=en_US&teamId=...&types=...&status=4&certificateStatus=0&type=distribution
|
34
|
+
|
35
|
+
certs = post_ajax(url)['certRequests']
|
36
|
+
|
37
|
+
ret_certs = []
|
38
|
+
|
39
|
+
# Select certificate
|
40
|
+
certificate_name = ENV['SIGH_CERTIFICATE']
|
41
|
+
cert_date = ENV['SIGH_CERTIFICATE_EXPIRE_DATE']
|
42
|
+
cert_id = ENV['SIGH_CERTIFICATE_ID']
|
43
|
+
|
44
|
+
# The other profiles are push profiles
|
45
|
+
certificate_type = type == DEVELOPMENT ? 'iOS Development' : 'iOS Distribution'
|
46
|
+
|
47
|
+
# New profiles first
|
48
|
+
certs.sort! do |a, b|
|
49
|
+
Time.parse(b['expirationDate']) <=> Time.parse(a['expirationDate'])
|
50
|
+
end
|
51
|
+
|
52
|
+
certs.each do |current_cert|
|
53
|
+
next unless current_cert['typeString'] == certificate_type
|
54
|
+
|
55
|
+
if cert_date || certificate_name || cert_id
|
56
|
+
if current_cert['expirationDateString'] == cert_date
|
57
|
+
Helper.log.info "Certificate ID '#{current_cert['certificateId']}' with expiry date '#{current_cert['expirationDateString']}' located".green
|
58
|
+
ret_certs << current_cert
|
59
|
+
end
|
60
|
+
|
61
|
+
if current_cert['name'] == certificate_name
|
62
|
+
Helper.log.info "Certificate ID '#{current_cert['certificateId']}' with name '#{certificate_name}' located".green
|
63
|
+
ret_certs << current_cert
|
64
|
+
end
|
65
|
+
|
66
|
+
if current_cert['certificateId'] == cert_id
|
67
|
+
Helper.log.info "Certificate ID '#{current_cert['certificateId']}' with name '#{current_cert['name']}' located".green
|
68
|
+
ret_certs << current_cert
|
69
|
+
end
|
70
|
+
else
|
71
|
+
ret_certs << current_cert
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
return ret_certs unless ret_certs.empty?
|
76
|
+
|
77
|
+
predicates = []
|
78
|
+
predicates << "name: #{certificate_name}" if certificate_name
|
79
|
+
predicates << "expiry date: #{cert_date}" if cert_date
|
80
|
+
predicates << "certificate ID: #{cert_id}" if cert_id
|
81
|
+
predicates << "type: #{(type == DEVELOPMENT ? 'development' : 'distribution')}"
|
82
|
+
|
83
|
+
predicates_str = " with #{predicates.join(', ')}"
|
84
|
+
|
85
|
+
raise "Could not find a Certificate#{predicates_str}. Please open #{current_url} and make sure you have a signing profile created, which mathces the given filters".red
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
data/lib/sigh/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sigh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix Krause
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fastlane_core
|
@@ -138,6 +138,7 @@ files:
|
|
138
138
|
- lib/sigh.rb
|
139
139
|
- lib/sigh/dependency_checker.rb
|
140
140
|
- lib/sigh/developer_center.rb
|
141
|
+
- lib/sigh/developer_center_signing.rb
|
141
142
|
- lib/sigh/resign.rb
|
142
143
|
- lib/sigh/version.rb
|
143
144
|
homepage: http://fastlane.tools
|