sigh 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -5
- data/bin/sigh +12 -2
- data/lib/sigh/dependency_checker.rb +0 -14
- data/lib/sigh/developer_center.rb +31 -16
- data/lib/sigh/version.rb +1 -1
- metadata +17 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bc2f125ac62833b6f980877187fea9b642eaca2
|
4
|
+
data.tar.gz: bc2ce6d75032cbe08b966552370e085294f9c05f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a2a88ce769189dbe80a2c72e69b87a24b9a6a37bae640473bc85dc242ba10bc1798335773b3ec453e9f938e8d84bc87396ba3c070563f764a54b136d5465d8b
|
7
|
+
data.tar.gz: 78d6a4bd5c00787c8c382fe8e0b857a27107873400f69ace914b35652cef0d25ef4020ea5722698f1004a0b455683f6294bb86037a10a365d2c5dd47618478ce
|
data/README.md
CHANGED
@@ -10,7 +10,8 @@
|
|
10
10
|
<a href="https://github.com/KrauseFx/snapshot">snapshot</a> •
|
11
11
|
<a href="https://github.com/KrauseFx/frameit">frameit</a> •
|
12
12
|
<a href="https://github.com/KrauseFx/PEM">PEM</a> •
|
13
|
-
<b>sigh</b>
|
13
|
+
<b>sigh</b> •
|
14
|
+
<a href="https://github.com/KrauseFx/produce">produce</a>
|
14
15
|
</p>
|
15
16
|
-------
|
16
17
|
|
@@ -81,10 +82,6 @@ Make sure, you have the latest version of the Xcode command line tools installed
|
|
81
82
|
|
82
83
|
xcode-select --install
|
83
84
|
|
84
|
-
Install phantomjs (this is needed to control the Apple Developer Portal)
|
85
|
-
|
86
|
-
brew update && brew install phantomjs
|
87
|
-
|
88
85
|
If you don't already have homebrew installed, [install it here](http://brew.sh/).
|
89
86
|
|
90
87
|
# Usage
|
@@ -109,10 +106,24 @@ If you want to generate a **Development** profile:
|
|
109
106
|
To generate the profile in a specific directory:
|
110
107
|
|
111
108
|
sigh -o "~/Certificates/"
|
109
|
+
|
110
|
+
### Advanced
|
112
111
|
|
113
112
|
By default, ```sigh``` will install the downloaded profile on your machine. If you just want to generate the profile and skip the installation, use the following flag:
|
114
113
|
|
115
114
|
sigh --skip_install
|
115
|
+
|
116
|
+
To save the provisioning profile under a specific name, use the -f option:
|
117
|
+
|
118
|
+
sigh -a com.krausefx.app -u username -f "myProfile.mobileprovision"
|
119
|
+
|
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:
|
121
|
+
|
122
|
+
sigh --force -a com.krausefx.app -u username
|
123
|
+
|
124
|
+
To renew a valid profile with a different certificate, look up the expiry date of the certificate you want to sign with in the Apple Developer Portal under Production Certificates. Copy the date string from there and use the following:
|
125
|
+
|
126
|
+
sigh --force -a com.krausefx.app -u username -d "Nov 11, 2017"
|
116
127
|
|
117
128
|
|
118
129
|
## Environment Variables
|
@@ -139,6 +150,7 @@ In case you prefer environment variables:
|
|
139
150
|
- [`snapshot`](https://github.com/KrauseFx/snapshot): Automate taking localized screenshots of your iOS app on every device
|
140
151
|
- [`frameit`](https://github.com/KrauseFx/frameit): Quickly put your screenshots into the right device frames
|
141
152
|
- [`PEM`](https://github.com/KrauseFx/pem): Automatically generate and renew your push notification profiles
|
153
|
+
- [`produce`](https://github.com/KrauseFx/produce): Create new iOS apps on iTunes Connect and Dev Portal using the command line
|
142
154
|
|
143
155
|
## Use the 'Provisioning Quicklook plugin'
|
144
156
|
Download and install the [Provisioning Plugin](https://github.com/chockenberry/Provisioning).
|
data/bin/sigh
CHANGED
@@ -7,6 +7,8 @@ require 'commander'
|
|
7
7
|
require 'credentials_manager/password_manager'
|
8
8
|
require 'credentials_manager/appfile_config'
|
9
9
|
|
10
|
+
require 'phantomjs/poltergeist'
|
11
|
+
|
10
12
|
HighLine.track_eof = false
|
11
13
|
|
12
14
|
class SighApplication
|
@@ -25,11 +27,14 @@ class SighApplication
|
|
25
27
|
global_option '--adhoc', 'By default, sigh will create and renew App Store profiles. Setting this flag will generate Adhoc profiles instead.'
|
26
28
|
global_option '--skip_install', 'By default, the certificate will be added on your local machine. Setting this flag will skip this action.'
|
27
29
|
global_option '--development', 'Renew the development certificate instead of the production one.'
|
30
|
+
global_option '--force', 'Renew non-development provisioning profiles regardless of state.'
|
28
31
|
|
29
32
|
global_option '-a', '--identifier STRING', String, 'The bundle identifier of your app.'
|
30
33
|
global_option '-u', '--username STRING', String, 'Your Apple ID username.'
|
31
34
|
global_option '-n', '--cert_name STRING', String, 'The name of the generated certificate file.'
|
32
35
|
global_option '-o', '--output STRING', String, 'The folder in which the file should be generated.'
|
36
|
+
global_option '-d', '--cert_date STRING', String, 'The certificate with the given expiry date used to renew. (e.g. "Nov 11, 2017")'
|
37
|
+
global_option '-f', '--filename STRING', String, 'Filename to use for the provisioning profile'
|
33
38
|
|
34
39
|
command :renew do |c|
|
35
40
|
c.syntax = 'sigh renew'
|
@@ -43,10 +48,15 @@ class SighApplication
|
|
43
48
|
type = Sigh::DeveloperCenter::ADHOC if options.adhoc
|
44
49
|
type = Sigh::DeveloperCenter::DEVELOPMENT if options.development
|
45
50
|
|
46
|
-
path = Sigh::DeveloperCenter.new.run(app, type, options.cert_name)
|
51
|
+
path = Sigh::DeveloperCenter.new.run(app, type, options.cert_name, options.force, options.cert_date)
|
47
52
|
|
48
53
|
if path
|
49
|
-
file_name = File.basename(path)
|
54
|
+
file_name = options.filename || File.basename(path)
|
55
|
+
if options.filename == nil
|
56
|
+
file_name = File.basename(path)
|
57
|
+
else
|
58
|
+
file_name = options.filename
|
59
|
+
end
|
50
60
|
output_path = options.output || '.'
|
51
61
|
output = File.join(output_path.gsub("~", ENV["HOME"]), file_name)
|
52
62
|
FileUtils.mv(path, output)
|
@@ -1,22 +1,8 @@
|
|
1
1
|
module Sigh
|
2
2
|
class DependencyChecker
|
3
3
|
def self.check_dependencies
|
4
|
-
self.check_phantom_js
|
5
4
|
self.check_xcode_select unless Helper.is_test?
|
6
5
|
end
|
7
|
-
|
8
|
-
def self.check_phantom_js
|
9
|
-
if `which phantomjs`.length == 0
|
10
|
-
# Missing brew dependency
|
11
|
-
Helper.log.fatal '#############################################################'
|
12
|
-
Helper.log.fatal "# You have to install phantomjs to use sigh"
|
13
|
-
Helper.log.fatal "# phantomjs is used to control the iTunesConnect frontend"
|
14
|
-
Helper.log.fatal "# Install Homebrew using http://brew.sh/" if `which brew`.length == 0
|
15
|
-
Helper.log.fatal "# Run 'brew update && brew install phantomjs' and start sigh again"
|
16
|
-
Helper.log.fatal '#############################################################'
|
17
|
-
raise "Run 'brew update && brew install phantomjs' and start sigh again"
|
18
|
-
end
|
19
|
-
end
|
20
6
|
|
21
7
|
def self.check_xcode_select
|
22
8
|
unless `xcode-select -v`.include?"xcode-select version "
|
@@ -42,6 +42,7 @@ module Sigh
|
|
42
42
|
Capybara.register_driver :poltergeist do |a|
|
43
43
|
conf = ['--debug=no', '--ignore-ssl-errors=yes', '--ssl-protocol=TLSv1']
|
44
44
|
Capybara::Poltergeist::Driver.new(a, {
|
45
|
+
phantomjs: Phantomjs.path,
|
45
46
|
phantomjs_options: conf,
|
46
47
|
phantomjs_logger: File.open("#{TMP_FOLDER}/poltergeist_log.txt", "a"),
|
47
48
|
js_errors: false
|
@@ -167,8 +168,8 @@ module Sigh
|
|
167
168
|
raise "Could not open Developer Center" unless result['status'] == 'success'
|
168
169
|
end
|
169
170
|
|
170
|
-
def run(app_identifier, type, cert_name = nil)
|
171
|
-
cert = maintain_app_certificate(app_identifier, type)
|
171
|
+
def run(app_identifier, type, cert_name = nil, force, cert_date)
|
172
|
+
cert = maintain_app_certificate(app_identifier, type, force, cert_date)
|
172
173
|
|
173
174
|
type_name = type
|
174
175
|
type_name = "Distribution" if type == APPSTORE # both enterprise and App Store
|
@@ -181,7 +182,7 @@ module Sigh
|
|
181
182
|
return output_path
|
182
183
|
end
|
183
184
|
|
184
|
-
def maintain_app_certificate(app_identifier, type)
|
185
|
+
def maintain_app_certificate(app_identifier, type, force, cert_date)
|
185
186
|
begin
|
186
187
|
if type == DEVELOPMENT
|
187
188
|
visit PROFILES_URL_DEV
|
@@ -220,11 +221,15 @@ module Sigh
|
|
220
221
|
end
|
221
222
|
|
222
223
|
# We found the correct certificate
|
223
|
-
if
|
224
|
+
if force and type != DEVELOPMENT
|
225
|
+
provisioningProfileId = current_cert['provisioningProfileId']
|
226
|
+
renew_profile(provisioningProfileId, type, cert_date) # This one needs to be forcefully renewed
|
227
|
+
return maintain_app_certificate(app_identifier, type, false, cert_date) # recursive
|
228
|
+
elsif current_cert['status'] == 'Active'
|
224
229
|
return download_profile(details['provisioningProfile']['provisioningProfileId']) # this one is already finished. Just download it.
|
225
230
|
elsif ['Expired', 'Invalid'].include?current_cert['status']
|
226
|
-
renew_profile(current_cert['provisioningProfileId'], type) # This one needs to be renewed
|
227
|
-
return maintain_app_certificate(app_identifier, type) # recursive
|
231
|
+
renew_profile(current_cert['provisioningProfileId'], type, cert_date) # This one needs to be renewed
|
232
|
+
return maintain_app_certificate(app_identifier, type, false, cert_date) # recursive
|
228
233
|
end
|
229
234
|
|
230
235
|
break
|
@@ -233,18 +238,18 @@ module Sigh
|
|
233
238
|
|
234
239
|
Helper.log.info "Could not find existing profile. Trying to create a new one."
|
235
240
|
# Certificate does not exist yet, we need to create a new one
|
236
|
-
create_profile(app_identifier, type)
|
241
|
+
create_profile(app_identifier, type, cert_date)
|
237
242
|
# After creating the profile, we need to download it
|
238
|
-
return maintain_app_certificate(app_identifier, type) # recursive
|
243
|
+
return maintain_app_certificate(app_identifier, type, false, cert_date) # recursive
|
239
244
|
|
240
245
|
rescue => ex
|
241
246
|
error_occured(ex)
|
242
247
|
end
|
243
248
|
end
|
244
249
|
|
245
|
-
def create_profile(app_identifier, type)
|
250
|
+
def create_profile(app_identifier, type, cert_date)
|
246
251
|
Helper.log.info "Creating new profile for app '#{app_identifier}' for type '#{type}'.".yellow
|
247
|
-
certificate = code_signing_certificate(type)
|
252
|
+
certificate = code_signing_certificate(type, cert_date)
|
248
253
|
|
249
254
|
create_url = "https://developer.apple.com/account/ios/profile/profileCreate.action"
|
250
255
|
visit create_url
|
@@ -314,8 +319,8 @@ module Sigh
|
|
314
319
|
wait_for_elements('.row-details')
|
315
320
|
end
|
316
321
|
|
317
|
-
def renew_profile(profile_id, type)
|
318
|
-
certificate = code_signing_certificate
|
322
|
+
def renew_profile(profile_id, type, cert_date)
|
323
|
+
certificate = code_signing_certificate(type, cert_date)
|
319
324
|
|
320
325
|
details_url = "https://developer.apple.com/account/ios/profile/profileEdit.action?type=&provisioningProfileId=#{profile_id}"
|
321
326
|
Helper.log.info "Renewing provisioning profile '#{profile_id}' using URL '#{details_url}'"
|
@@ -379,7 +384,7 @@ module Sigh
|
|
379
384
|
# "certificateTypeDisplayId"=>"...",
|
380
385
|
# "serialNum"=>"....",
|
381
386
|
# "typeString"=>"iOS Distribution"},
|
382
|
-
def code_signing_certificate(type)
|
387
|
+
def code_signing_certificate(type, cert_date)
|
383
388
|
certs_url = "https://developer.apple.com/account/ios/certificate/certificateList.action?type="
|
384
389
|
certs_url << "distribution" if type != DEVELOPMENT
|
385
390
|
certs_url << "development" if type == DEVELOPMENT
|
@@ -398,13 +403,23 @@ module Sigh
|
|
398
403
|
if type != DEVELOPMENT and current_cert['typeString'] == 'iOS Distribution'
|
399
404
|
# The other profiles are push profiles
|
400
405
|
# We only care about the distribution profile
|
401
|
-
|
402
|
-
|
406
|
+
unless cert_date
|
407
|
+
return current_cert # mostly we only care about the 'certificateId'
|
408
|
+
else
|
409
|
+
if current_cert['expirationDateString'] == cert_date
|
410
|
+
Helper.log.info "Certificate ID '#{current_cert['certificateId']}' with expiry date '#{current_cert['expirationDateString']}' located"
|
411
|
+
return current_cert
|
412
|
+
end
|
413
|
+
end
|
414
|
+
elsif type == DEVELOPMENT and current_cert['typeString'] == 'iOS Development'
|
403
415
|
return current_cert # mostly we only care about the 'certificateId'
|
404
416
|
end
|
405
417
|
end
|
406
418
|
|
407
|
-
|
419
|
+
error_message_no_cert_with_date = "Could not find a Certificate with expiry date '#{cert_date}'. Please open #{current_url} and make sure you have a signing profile created.".red
|
420
|
+
error_message_no_cert = "Could not find a Certificate. Please open #{current_url} and make sure you have a signing profile created.".red
|
421
|
+
|
422
|
+
raise cert_date ? error_message_no_cert_with_date : error_message_no_cert
|
408
423
|
end
|
409
424
|
|
410
425
|
# Download a file from the dev center, by using a HTTP client. This will return the content of the file
|
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.2.
|
4
|
+
version: 0.2.2
|
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-
|
11
|
+
date: 2015-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: phantomjs
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.9.8
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.9.8
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: capybara
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -228,8 +242,7 @@ homepage: http://fastlane.tools
|
|
228
242
|
licenses:
|
229
243
|
- MIT
|
230
244
|
metadata: {}
|
231
|
-
post_install_message:
|
232
|
-
install phantomjs'
|
245
|
+
post_install_message:
|
233
246
|
rdoc_options: []
|
234
247
|
require_paths:
|
235
248
|
- lib
|