pem 0.1.3 → 0.1.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 +24 -6
- data/bin/pem +6 -6
- data/lib/pem/cert_manager.rb +4 -3
- data/lib/pem/developer_center.rb +20 -17
- data/lib/pem/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7edf95975cba2399652b2744959bfed9685c4294
|
4
|
+
data.tar.gz: e389b47259d1fbfd6aaa36287a5187b697c99784
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bc479d395be07e1d7614b55b6a4c2ea5a81da9fb87f911c46debb687432c2e0cf41ba03a084750689f7f40b31a5e68aeb1c6fc321529a253262462cf943548d
|
7
|
+
data.tar.gz: eb66fe2cc46d49e55571abb17d6803d9e0b558132ddc91ca845d123f4ee5f147e871e29b641be52ad1e498ddd4996c39dfab87470f2fe4d783d6a9d1f1589a40
|
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
<p align="center">
|
2
|
-
<a href="https://github.com/KrauseFx/deliver">Deliver</a> •
|
3
|
-
<a href="https://github.com/KrauseFx/snapshot">Snapshot</a> •
|
4
|
-
<a href="https://github.com/KrauseFx/frameit">FrameIt</a> •
|
5
|
-
<b>PEM</b>
|
2
|
+
<a href="https://github.com/KrauseFx/deliver">Deliver</a> •
|
3
|
+
<a href="https://github.com/KrauseFx/snapshot">Snapshot</a> •
|
4
|
+
<a href="https://github.com/KrauseFx/frameit">FrameIt</a> •
|
5
|
+
<b>PEM</b> •
|
6
|
+
<a href="https://github.com/KrauseFx/sigh">Sigh</a>
|
6
7
|
</p>
|
7
8
|
-------
|
8
9
|
|
@@ -10,7 +11,7 @@
|
|
10
11
|
<img src="assets/pem.png">
|
11
12
|
</p>
|
12
13
|
|
13
|
-
Pem
|
14
|
+
Pem - Maintain your push certificates
|
14
15
|
============
|
15
16
|
|
16
17
|
[](https://twitter.com/KrauseFx)
|
@@ -52,6 +53,12 @@ Make sure, you have the latest version of the Xcode command line tools installed
|
|
52
53
|
|
53
54
|
xcode-select --install
|
54
55
|
|
56
|
+
Install phantomjs (this is needed to control the Apple Developer Portal)
|
57
|
+
|
58
|
+
brew update && brew install phantomjs
|
59
|
+
|
60
|
+
If you don't already have homebrew installed, [install it here](http://brew.sh/).
|
61
|
+
|
55
62
|
# Usage
|
56
63
|
|
57
64
|
pem
|
@@ -68,6 +75,10 @@ You can pass parameters like this:
|
|
68
75
|
|
69
76
|
pem -a at.felixkrause.app -u username
|
70
77
|
|
78
|
+
If you want to generate a development certificate instead:
|
79
|
+
|
80
|
+
pem --development
|
81
|
+
|
71
82
|
## Environment Variables
|
72
83
|
In case you prefer environment variables:
|
73
84
|
|
@@ -88,7 +99,14 @@ There are 2 actions involved:
|
|
88
99
|
```PEM``` uses the password manager from [```Deliver```](https://github.com/KrauseFx/deliver#can-i-trust-deliver). Take a look the [Deliver README](https://github.com/KrauseFx/deliver#can-i-trust-deliver) for more information.
|
89
100
|
|
90
101
|
# Tips
|
91
|
-
##
|
102
|
+
## Other helpful tools
|
103
|
+
Check out other tools in this collection to speed up your deployment process:
|
104
|
+
- [```deliver```](https://github.com/KrauseFx/deliver): Deploy screenshots, app metadata and app updates to the App Store using just one command
|
105
|
+
- [```snapshot```](https://github.com/KrauseFx/snapshot): Create hundreds of screenshots of your iPhone app... while doing something else
|
106
|
+
- [```FrameIt```](https://github.com/KrauseFx/frameit): Want a device frame around your screenshot? Do it in an instant!
|
107
|
+
- [```sigh```](https://github.com/KrauseFx/sigh): Because you would rather spend your time building stuff than fighting provisioning.
|
108
|
+
|
109
|
+
## Use the 'Provisioning Quicklook plugin'
|
92
110
|
Download and install the [Provisioning Plugin](https://github.com/chockenberry/Provisioning).
|
93
111
|
|
94
112
|
It will show you the ```pem``` files like this:
|
data/bin/pem
CHANGED
@@ -20,8 +20,6 @@ program :help_formatter, :compact
|
|
20
20
|
|
21
21
|
global_option('--verbose') { $verbose = true }
|
22
22
|
|
23
|
-
default_command :run
|
24
|
-
|
25
23
|
|
26
24
|
command :renew do |c|
|
27
25
|
c.syntax = 'pem renew'
|
@@ -29,6 +27,7 @@ command :renew do |c|
|
|
29
27
|
|
30
28
|
c.option '-a', '--identifier STRING', String, 'The bundle identifier of your app'
|
31
29
|
c.option '-u', '--username STRING', String, 'Your Apple ID username'
|
30
|
+
c.option '--development', 'Renew the development push certificate instead of the production one'
|
32
31
|
|
33
32
|
c.action do |args, options|
|
34
33
|
app = app_identifier(options)
|
@@ -36,12 +35,13 @@ command :renew do |c|
|
|
36
35
|
|
37
36
|
PEM::UpdateChecker.verify_latest_version
|
38
37
|
|
39
|
-
path = PEM::CertManager.new.run(app)
|
38
|
+
path = PEM::CertManager.new.run(app, !options.development)
|
40
39
|
|
41
40
|
if path
|
42
|
-
|
41
|
+
file_name = File.basename(path)
|
42
|
+
output = "./#{file_name}"
|
43
43
|
FileUtils.mv(path, output)
|
44
|
-
puts output
|
44
|
+
puts output.green
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
@@ -60,4 +60,4 @@ def app_identifier(options)
|
|
60
60
|
return options.identifier if options.identifier
|
61
61
|
return ENV["PEM_APP_IDENTIFIER"] if ENV["PEM_APP_IDENTIFIER"]
|
62
62
|
return ask("App Identifier (Bundle ID, e.g. at.felixkrause.app): ")
|
63
|
-
end
|
63
|
+
end
|
data/lib/pem/cert_manager.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module PEM
|
2
2
|
class CertManager
|
3
3
|
# Download the cert, do all kinds of Keychain related things
|
4
|
-
def run(app_identifier)
|
4
|
+
def run(app_identifier, production)
|
5
5
|
# Keychain (security) documentation: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/security.1.html
|
6
6
|
# Old project, which might be helpful: https://github.com/jprichardson/keychain_manager
|
7
7
|
|
@@ -11,7 +11,7 @@ module PEM
|
|
11
11
|
|
12
12
|
keychain = "PEM.keychain"
|
13
13
|
|
14
|
-
cert_file = dev.fetch_cer_file(app_identifier)
|
14
|
+
cert_file = dev.fetch_cer_file(app_identifier, production)
|
15
15
|
rsa_file = [TMP_FOLDER, 'myrsa'].join('/')
|
16
16
|
|
17
17
|
previous_keychain = command("security default-keychain")
|
@@ -30,7 +30,8 @@ module PEM
|
|
30
30
|
|
31
31
|
command("security export -k '#{keychain}' -t all -f pkcs12 -P '' -o #{p12_file}") # export code signing identity
|
32
32
|
|
33
|
-
|
33
|
+
certificate_type = (production ? 'production' : 'development')
|
34
|
+
pem_file = [TMP_FOLDER, "#{certificate_type}_#{app_identifier}.pem"].join('')
|
34
35
|
command("openssl pkcs12 -passin pass: -nodes -in #{p12_file} -out #{pem_file}")
|
35
36
|
|
36
37
|
command("security delete-keychain #{keychain}")
|
data/lib/pem/developer_center.rb
CHANGED
@@ -23,6 +23,7 @@ module PEM
|
|
23
23
|
|
24
24
|
# Strings
|
25
25
|
PRODUCTION_SSL_CERTIFICATE_TITLE = "Production SSL Certificate"
|
26
|
+
DEVELOPMENT_SSL_CERTIFICATE_TITLE = "Development SSL Certificate"
|
26
27
|
|
27
28
|
def initialize
|
28
29
|
FileUtils.mkdir_p TMP_FOLDER
|
@@ -46,6 +47,8 @@ module PEM
|
|
46
47
|
})
|
47
48
|
end
|
48
49
|
|
50
|
+
page.driver.headers = { "Accept-Language" => "en" }
|
51
|
+
|
49
52
|
self.login
|
50
53
|
end
|
51
54
|
|
@@ -99,14 +102,10 @@ module PEM
|
|
99
102
|
end
|
100
103
|
end
|
101
104
|
|
102
|
-
def app_status(app_identifier)
|
103
|
-
# TODO
|
104
|
-
end
|
105
|
-
|
106
105
|
# This method will enable push for the given app
|
107
106
|
# and download the cer file in any case, no matter if it existed before or not
|
108
107
|
# @return the path to the push file
|
109
|
-
def fetch_cer_file(app_identifier)
|
108
|
+
def fetch_cer_file(app_identifier, production)
|
110
109
|
begin
|
111
110
|
open_app_page(app_identifier)
|
112
111
|
|
@@ -151,35 +150,38 @@ module PEM
|
|
151
150
|
# </div>
|
152
151
|
# </div>
|
153
152
|
|
154
|
-
def find_download_button
|
153
|
+
def find_download_button(section_title)
|
155
154
|
wait_for_elements(".formContent")
|
156
155
|
|
157
156
|
certificates_block = first('.appCertificates')
|
158
157
|
download_button = nil
|
159
158
|
|
160
|
-
|
159
|
+
found_section = false
|
161
160
|
certificates_block.all(:xpath, "./div").each do |div|
|
162
|
-
if
|
161
|
+
if found_section
|
163
162
|
# We're now in the second part, we only care about production certificates
|
164
163
|
if (download_button = div.first(".download-button"))
|
165
164
|
return download_button
|
166
165
|
end
|
167
166
|
end
|
168
167
|
|
169
|
-
|
168
|
+
found_section = false if div["class"] == 'title' # next section, might be from dev to production
|
169
|
+
found_section = true if div.text == section_title
|
170
170
|
end
|
171
171
|
nil
|
172
172
|
end
|
173
173
|
|
174
|
+
section_title = (production ? PRODUCTION_SSL_CERTIFICATE_TITLE : DEVELOPMENT_SSL_CERTIFICATE_TITLE)
|
175
|
+
certificate_type = (production ? 'production' : 'development')
|
174
176
|
|
175
|
-
download_button = find_download_button
|
177
|
+
download_button = find_download_button(section_title)
|
176
178
|
|
177
179
|
if not download_button
|
178
|
-
Helper.log.warn "Push for app '#{app_identifier}' is enabled, but there is no
|
179
|
-
create_push_for_app(app_identifier)
|
180
|
+
Helper.log.warn "Push for app '#{app_identifier}' is enabled, but there is no #{certificate_type} certificate yet."
|
181
|
+
create_push_for_app(app_identifier, production)
|
180
182
|
|
181
|
-
download_button = find_download_button
|
182
|
-
raise "Could not find download button for
|
183
|
+
download_button = find_download_button(section_title)
|
184
|
+
raise "Could not find download button for #{section_title}. Check out: '#{current_url}'" unless download_button
|
183
185
|
end
|
184
186
|
|
185
187
|
|
@@ -198,7 +200,7 @@ module PEM
|
|
198
200
|
|
199
201
|
raise "Something went wrong when downloading the certificate" unless data
|
200
202
|
|
201
|
-
path = "#{TMP_FOLDER}/
|
203
|
+
path = "#{TMP_FOLDER}/aps_#{certificate_type}_#{app_identifier}.cer"
|
202
204
|
File.write(path, data)
|
203
205
|
|
204
206
|
Helper.log.info "Successfully downloaded latest .cer file."
|
@@ -229,8 +231,9 @@ module PEM
|
|
229
231
|
end
|
230
232
|
end
|
231
233
|
|
232
|
-
def create_push_for_app(app_identifier)
|
233
|
-
|
234
|
+
def create_push_for_app(app_identifier, production)
|
235
|
+
element_name = (production ? '.button.small.navLink.distribution.enabled' : '.button.small.navLink.development.enabled')
|
236
|
+
wait_for_elements(element_name).last.click # Create Certificate button
|
234
237
|
|
235
238
|
sleep 2
|
236
239
|
|
data/lib/pem/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.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: 2014-11-
|
11
|
+
date: 2014-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -244,7 +244,8 @@ homepage: http://felixkrause.at
|
|
244
244
|
licenses:
|
245
245
|
- MIT
|
246
246
|
metadata: {}
|
247
|
-
post_install_message:
|
247
|
+
post_install_message: This gem requires phantomjs. Install it using 'brew update &&
|
248
|
+
brew install phantomjs'
|
248
249
|
rdoc_options: []
|
249
250
|
require_paths:
|
250
251
|
- lib
|