pem 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 190079e284f19718e7136a81bbd5d7c54ce68e38
4
- data.tar.gz: 71c615d63434145eee04e13d203a1706b6ca15b9
3
+ metadata.gz: 15172a7853a4ce1f52abd5c16f18bbc6ea5de072
4
+ data.tar.gz: a7d6bdd8ec40eafc0040db4944bc76737548bfb8
5
5
  SHA512:
6
- metadata.gz: 8de2769636d1293ed97ef4978a84919334be3b018ff4f16a3043797ce65f2a4cd30a2a0573bb93ae379bc1a24050b03846d809a87ef1118cd9f9e58544fcf588
7
- data.tar.gz: 9e5ea4f6e75b675cd75a7fb235759d2c97518082fc5632cf69a4d4f9e15afff98acb8ee0d6019001871cc81148229f917ec2c87c5ce6f79600bd7c32ef49089c
6
+ metadata.gz: fe57a4744f64c10597b4cc3cf661aae7f6c68b3d111e74bd35b60763064975a87bc20725d0ab4faa27a2a7454ee62f3011efcae5d91d55178618964b0011b124
7
+ data.tar.gz: 143f0012b48148f1117ca663b7a06c75d161d3c4bd1361640f56210831578a7c512750cb1750547ab84a8fa8391ed7c55b5f2066965f9381aabde8dedfcf0029
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2014 Felix Krause
3
+ Copyright (c) 2015 Felix Krause
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -148,69 +148,9 @@ module PEM
148
148
  first(:css, '#pushEnabled').click
149
149
  end
150
150
 
151
- sleep 1
152
-
153
- # Example code
154
- # <div class="appCertificates">
155
- # <h3>Apple Push Notification service SSL Certificates</h3>
156
- # <p>To configure push notifications for this iOS App ID, a Client SSL Certificate that allows your notification server to connect to the Apple Push Notification Service is required. Each iOS App ID requires its own Client SSL Certificate. Manage and generate your certificates below.</p>
157
- # <div class="title" data-hires-status="replaced">Development SSL Certificate</div>
158
- # <div class="createCertificate">
159
- # <p>Create certificate to use for this App ID.</p>
160
- # <a class="button small navLink development enabled" href="/account/ios/certificate/certificateRequest.action?appIdId=...&amp;types=..."><span>Create Certificate...</span></a>
161
- # </div>
162
- # <div class="title" data-hires-status="replaced">Production SSL Certificate</div>
163
- # <div class="certificate">
164
- # <dl>
165
- # <dt>Name:</dt>
166
- # <dd>Apple Production iOS Push Services: net.sunapps.151</dd>
167
- # <dt>Type:</dt>
168
- # <dd>APNs Production iOS</dd>
169
- # <dt>Expires:</dt>
170
- # <dd>Nov 14, 2015</dd>
171
- # </dl>
172
- # <a class="button small revoke-button" href="https://developer.apple.com/services-account/QH65B2/account/ios/certificate/revokeCertificate.action?content-type=application/x-www-form-urlencoded&amp;accept=application/json&amp;requestId=....;userLocale=en_US&amp;teamId=...&amp;certificateId=...&amp;type=...."><span>Revoke</span></a>
173
- # <a class="button small download-button" href="/account/ios/certificate/certificateContentDownload.action?displayId=....&amp;type=..."><span>Download</span></a>
174
- # </div>
175
- # <div class="createCertificate">
176
- # <p>Create an additional certificate to use for this App ID.</p>
177
- # <a class="button small navLink distribution enabled" href="/account/ios/certificate/certificateRequest.action?appIdId=...&amp;types=..."><span>Create Certificate...</span></a>
178
- # </div>
179
- # </div>
180
-
181
- def find_download_button(section_title)
182
- wait_for_elements(".formContent")
183
-
184
- certificates_block = first('.appCertificates')
185
- download_button = nil
186
-
187
- found_section = false
188
- certificates_block.all(:xpath, "./div").each do |div|
189
- if found_section
190
- # We're now in the second part, we only care about production certificates
191
- if (download_button = div.first(".download-button"))
192
- return download_button
193
- end
194
- end
195
-
196
- found_section = false if div["class"] == 'title' # next section, might be from dev to production
197
- found_section = true if div.text == section_title
198
- end
199
- nil
200
- end
201
-
202
- section_title = (production ? PRODUCTION_SSL_CERTIFICATE_TITLE : DEVELOPMENT_SSL_CERTIFICATE_TITLE)
203
- certificate_type = (production ? 'production' : 'development')
204
-
205
- download_button = find_download_button(section_title)
206
-
207
- if not download_button
208
- Helper.log.warn "Push for app '#{app_identifier}' is enabled, but there is no #{certificate_type} certificate yet."
209
- create_push_for_app(app_identifier, production)
210
- else
211
- raise "Could not create a new push profile for app '#{app_identifier}'. There is already a profile active.".red
212
- end
213
- rescue Exception => ex
151
+ Helper.log.warn "Creating push certificate for app '#{app_identifier}'."
152
+ create_push_for_app(app_identifier, production)
153
+ rescue => ex
214
154
  error_occured(ex)
215
155
  end
216
156
  end
@@ -237,7 +177,11 @@ module PEM
237
177
 
238
178
  def create_push_for_app(app_identifier, production)
239
179
  element_name = (production ? '.button.small.navLink.distribution.enabled' : '.button.small.navLink.development.enabled')
240
- wait_for_elements(element_name).last.click # Create Certificate button
180
+ begin
181
+ wait_for_elements(element_name).first.click # Create Certificate button
182
+ rescue
183
+ raise "Could not create a new push profile for app '#{app_identifier}'. There are already 2 certificates active. Please revoke one to let PEM create a new one\n\n#{current_url}".red
184
+ end
241
185
 
242
186
  sleep 2
243
187
 
@@ -269,7 +213,7 @@ module PEM
269
213
  host = Capybara.current_session.current_host
270
214
  url = download_button['href']
271
215
  url = [host, url].join('')
272
- puts url
216
+ Helper.log.info "Downloading URL: '#{url}'"
273
217
 
274
218
  cookieString = ""
275
219
 
@@ -328,4 +272,4 @@ module PEM
328
272
  return results
329
273
  end
330
274
  end
331
- end
275
+ end
data/lib/pem/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module PEM
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
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.2.2
4
+ version: 0.2.3
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-12-23 00:00:00.000000000 Z
11
+ date: 2015-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json