pem 0.8.0 → 0.8.1
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 +1 -1
- data/bin/pem +1 -1
- data/lib/pem.rb +0 -3
- data/lib/pem/manager.rb +68 -56
- data/lib/pem/options.rb +2 -2
- data/lib/pem/version.rb +1 -1
- metadata +35 -8
- data/lib/pem/dependency_checker.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0b32385a65fea0f12fc5eb645fe1f0e3e9fdb63
|
4
|
+
data.tar.gz: 097ce337c4fb019752c283a8d4be436c8b54fc36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66e36259fcd8f0870760122e8f5d5208193d11511757582a33ed51304e937fcb7df282081bdff64914d4fea377e621f3ac3230ed675c87d3d4af7a5143960d4c
|
7
|
+
data.tar.gz: 661929ad101fd354bf134bc7849e685066b777e66e7a6d71e61d91a15e6e2aa5aa7312b1228ac8385f305a4e37bfbc26a815c2a1d13821eb675551d29d0d844b
|
data/README.md
CHANGED
@@ -36,7 +36,7 @@ PEM
|
|
36
36
|
|
37
37
|
Tired of manually creating and maintaining your push notification profiles for your iOS apps? Tired of generating a `pem` file for your server?
|
38
38
|
|
39
|
-
|
39
|
+
`PEM` does all that for, just by running `pem`.
|
40
40
|
|
41
41
|
To automate iOS Provisioning profiles you can use [sigh](https://github.com/KrauseFx/sigh).
|
42
42
|
|
data/bin/pem
CHANGED
data/lib/pem.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'pem/version'
|
2
|
-
require 'pem/dependency_checker'
|
3
2
|
require 'pem/manager'
|
4
3
|
require 'pem/options'
|
5
4
|
|
@@ -18,6 +17,4 @@ module PEM
|
|
18
17
|
ENV['DELIVER_USER'] ||= ENV["PEM_USERNAME"]
|
19
18
|
|
20
19
|
Helper = FastlaneCore::Helper # you gotta love Ruby: Helper.* should use the Helper class contained in FastlaneCore
|
21
|
-
|
22
|
-
DependencyChecker.check_dependencies
|
23
20
|
end
|
data/lib/pem/manager.rb
CHANGED
@@ -4,76 +4,88 @@ require 'spaceship'
|
|
4
4
|
module PEM
|
5
5
|
# Creates the push profile and stores it in the correct location
|
6
6
|
class Manager
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
Spaceship.client.select_team
|
11
|
-
Helper.log.info "Successfully logged in"
|
7
|
+
class << self
|
8
|
+
def start
|
9
|
+
login
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
existing_certificate = certificate.all.detect do |c|
|
12
|
+
c.name == PEM.config[:app_identifier]
|
13
|
+
end
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
15
|
+
if existing_certificate
|
16
|
+
remaining_days = (existing_certificate.expires - Time.now) / 60 / 60 / 24
|
17
|
+
Helper.log.info "Existing push notification profile '#{existing_certificate.owner_name}' is valid for #{remaining_days.round} more days."
|
18
|
+
if remaining_days > 30
|
19
|
+
if PEM.config[:force]
|
20
|
+
Helper.log.info "You already have an existing push certificate, but a new one will be created since the --force option has been set.".green
|
21
|
+
else
|
22
|
+
Helper.log.info "You already have a push certificate, which is active for more than 30 more days. No need to create a new one".green
|
23
|
+
Helper.log.info "If you still want to create a new one, use the --force option when running PEM.".green
|
24
|
+
return false
|
25
|
+
end
|
27
26
|
end
|
28
27
|
end
|
28
|
+
|
29
|
+
return create_certificate
|
29
30
|
end
|
30
31
|
|
31
|
-
|
32
|
+
def login
|
33
|
+
Helper.log.info "Starting login with user '#{PEM.config[:username]}'"
|
34
|
+
Spaceship.login(PEM.config[:username], nil)
|
35
|
+
Spaceship.client.select_team
|
36
|
+
Helper.log.info "Successfully logged in"
|
37
|
+
end
|
32
38
|
|
33
|
-
|
39
|
+
# rubocop:disable Metrics/AbcSize
|
40
|
+
def create_certificate
|
41
|
+
Helper.log.warn "Creating a new push certificate for app '#{PEM.config[:app_identifier]}'."
|
34
42
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
43
|
+
csr, pkey = Spaceship.certificate.create_certificate_signing_request
|
44
|
+
|
45
|
+
begin
|
46
|
+
cert = certificate.create!(csr: csr, bundle_id: PEM.config[:app_identifier])
|
47
|
+
rescue => ex
|
48
|
+
if ex.to_s.include? "You already have a current"
|
49
|
+
# That's the most common failure probably
|
50
|
+
Helper.log.info ex.to_s
|
51
|
+
Helper.log.error "You already have 2 active push profiles for this application/environment.".red
|
52
|
+
Helper.log.error "You'll need to revoke an old certificate to make room for a new one".red
|
53
|
+
else
|
54
|
+
raise ex
|
55
|
+
end
|
45
56
|
end
|
46
|
-
end
|
47
57
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
58
|
+
x509_certificate = cert.download
|
59
|
+
certificate_type = (PEM.config[:development] ? 'development' : 'production')
|
60
|
+
filename_base = PEM.config[:pem_name] || "#{certificate_type}_#{PEM.config[:app_identifier]}"
|
61
|
+
filename_base = File.basename(filename_base, ".pem") # strip off the .pem if it was provided.
|
52
62
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
63
|
+
if PEM.config[:save_private_key]
|
64
|
+
private_key_path = File.join(PEM.config[:output_path], "#{filename_base}.pkey")
|
65
|
+
File.write(private_key_path, pkey.to_pem)
|
66
|
+
Helper.log.info "Private key: ".green + Pathname.new(private_key_path).realpath.to_s
|
67
|
+
end
|
58
68
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
69
|
+
if PEM.config[:generate_p12]
|
70
|
+
p12_cert_path = File.join(PEM.config[:output_path], "#{filename_base}.p12")
|
71
|
+
p12 = OpenSSL::PKCS12.create(PEM.config[:p12_password], certificate_type, pkey, x509_certificate)
|
72
|
+
File.write(p12_cert_path, p12.to_der)
|
73
|
+
Helper.log.info "p12 certificate: ".green + Pathname.new(p12_cert_path).realpath.to_s
|
74
|
+
end
|
65
75
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
76
|
+
x509_cert_path = File.join(PEM.config[:output_path], "#{filename_base}.pem")
|
77
|
+
File.write(x509_cert_path, x509_certificate.to_pem + pkey.to_pem)
|
78
|
+
Helper.log.info "PEM: ".green + Pathname.new(x509_cert_path).realpath.to_s
|
79
|
+
return x509_cert_path
|
80
|
+
end
|
81
|
+
# rubocop:enable Metrics/AbcSize
|
71
82
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
83
|
+
def certificate
|
84
|
+
if PEM.config[:development]
|
85
|
+
Spaceship.certificate.development_push
|
86
|
+
else
|
87
|
+
Spaceship.certificate.production_push
|
88
|
+
end
|
77
89
|
end
|
78
90
|
end
|
79
91
|
end
|
data/lib/pem/options.rb
CHANGED
@@ -41,8 +41,8 @@ module PEM
|
|
41
41
|
env_name: "PEM_TEAM_ID",
|
42
42
|
description: "The ID of your team if you're in multiple teams",
|
43
43
|
optional: true,
|
44
|
-
verify_block:
|
45
|
-
|
44
|
+
verify_block: proc do |value|
|
45
|
+
ENV["FASTLANE_TEAM_ID"] = value
|
46
46
|
end),
|
47
47
|
FastlaneCore::ConfigItem.new(key: :p12_password,
|
48
48
|
short_option: "-p",
|
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.8.
|
4
|
+
version: 0.8.1
|
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-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fastlane_core
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.19.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 1.0.0
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
29
|
+
version: 0.19.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 1.0.0
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 0.
|
39
|
+
version: 0.11.2
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.
|
46
|
+
version: 0.11.2
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,6 +142,34 @@ dependencies:
|
|
142
142
|
- - ">="
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: '0'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: fastlane
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
name: rubocop
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - "~>"
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0.34'
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - "~>"
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '0.34'
|
145
173
|
description: Automatically generate and renew your push notification profiles
|
146
174
|
email:
|
147
175
|
- pem@krausefx.com
|
@@ -154,7 +182,6 @@ files:
|
|
154
182
|
- README.md
|
155
183
|
- bin/pem
|
156
184
|
- lib/pem.rb
|
157
|
-
- lib/pem/dependency_checker.rb
|
158
185
|
- lib/pem/manager.rb
|
159
186
|
- lib/pem/options.rb
|
160
187
|
- lib/pem/version.rb
|
@@ -178,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
205
|
version: '0'
|
179
206
|
requirements: []
|
180
207
|
rubyforge_project:
|
181
|
-
rubygems_version: 2.4.
|
208
|
+
rubygems_version: 2.4.5
|
182
209
|
signing_key:
|
183
210
|
specification_version: 4
|
184
211
|
summary: Automatically generate and renew your push notification profiles
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module PEM
|
2
|
-
class DependencyChecker
|
3
|
-
def self.check_dependencies
|
4
|
-
return if Helper.is_test?
|
5
|
-
self.check_xcode_select
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.check_xcode_select
|
9
|
-
unless `xcode-select -v`.include?("xcode-select version ")
|
10
|
-
Helper.log.fatal '#############################################################'
|
11
|
-
Helper.log.fatal "# You have to install the Xcode commdand line tools to use PEM"
|
12
|
-
Helper.log.fatal "# Install the latest version of Xcode from the AppStore"
|
13
|
-
Helper.log.fatal "# Run xcode-select --install to install the developer tools"
|
14
|
-
Helper.log.fatal '#############################################################'
|
15
|
-
raise "Run 'xcode-select --install' and start PEM again"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|