ghost_in_the_post 0.0.13 → 0.0.14

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: ecb69f619c5f9cab35fd78c4c77d3129ce0f9015
4
- data.tar.gz: d8c1aa62c3d6749e5e018c4a2edb4390443e98db
3
+ metadata.gz: 4854e245fe24316010a61d16bb6d8708be6bb54d
4
+ data.tar.gz: f57f1f1b55eb911f65a1d5691705bc38b12ee7af
5
5
  SHA512:
6
- metadata.gz: d08c96cf962aba8f9f47ce484d58c1b072a73320e20fb6abdca10e6ade7344a389e62440fe80675a34a01249eceb6f9a4d26f05984ec9084405a54933980971c
7
- data.tar.gz: d38194d13b447b38342656140b79e21c28dc0b7426fba28870464125ba4ba8cf3c7e375b5db346c0c160b0d0f4f28c67200bb4cab4d3bbca1b180611cbc552a3
6
+ metadata.gz: 7b211875500f8abf390e22245b4d893b83c8bf03d30e5074bd73f32c9cdf8fedf21530a9235c8ce9a765d3e7d94fa4470f1afda9b9635a44fc9b22840892a093
7
+ data.tar.gz: 39dec3a48fa5eaaba2c385093a6973e795c5a3052d2405eddfda6159229410340008434790d8612d7a286acbe7c74b1cf9aefd61fd97e934b607754fc3583da4
@@ -1,8 +1,8 @@
1
1
  var system = require('system'),
2
2
  page = require('webpage').create(),
3
3
  address = system.args[1], //tmp file of the html to be processed
4
- timeout = parseInt(system.args[4]) || 1000, //return page contents after a timeout
5
- wait_event = system.args[5], //return page contents after an event
4
+ timeout = parseInt(system.args[2]) || 1000, //return page contents after a timeout
5
+ wait_event = system.args[3], //return page contents after an event
6
6
  error_tag = "[GHOSTINTHEPOST-STATICIZE-ERROR]";
7
7
 
8
8
  //write out to console to export contents
@@ -12,16 +12,8 @@ function finish(){
12
12
  phantom.exit();
13
13
  }
14
14
 
15
- //commented out because stuff like stylesheets and images will fail in situations where they shouldnt
16
- //page.onResourceError = function(resourceError) {
17
- //console.log(error_tag);
18
- //console.log('Unable to load resource (#' + resourceError.id + 'URL:' + resourceError.url + ')');
19
- //console.log('Error code: ' + resourceError.errorCode + '. Description: ' + resourceError.errorString);
20
- //phantom.exit();
21
- //};
22
-
23
15
  page.onError = function(msg, trace) {
24
- console.log(error_tag);
16
+ console.error(error_tag);
25
17
  var msgStack = ['ERROR: ' + msg];
26
18
  if (trace && trace.length) {
27
19
  msgStack.push('TRACE:');
@@ -32,13 +24,15 @@ page.onError = function(msg, trace) {
32
24
  console.error(msgStack.join('\n'));
33
25
  phantom.exit();
34
26
  };
27
+
28
+ page.onCallback = finish
29
+ page.onInitialized = function() {
30
+ page.evaluate(function(wait_event) {
31
+ document.addEventListener(wait_event, window.callPhantom, false)
32
+ }, wait_event)
33
+ };
35
34
 
36
35
  page.onLoadFinished = function(status){
37
- //catch wait_event
38
- page.onCallback = finish
39
- page.evaluate(function(finish, wait_event) {
40
- document.addEventListener(wait_event, window.callPhantom, false)
41
- }, finish, wait_event)
42
36
  if(timeout > 0){
43
37
  setTimeout(finish, timeout);//timout to bailout after a period
44
38
  }
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
+ </head>
6
+ <body>
7
+ <div id="json" data-json="%7B%22key%22%3A%22value%22%2C%22test%22%3A%5B%22one%22%2C%22two%22%2C%22three%22%5D%7D"></div>
8
+ <div id="test"></div>
9
+ <script>
10
+ (function(){
11
+ var testel = document.getElementById('test');
12
+ testel.innerHTML='complete';
13
+ var datael = document.getElementById('json');
14
+ var data;
15
+ data=JSON.parse(decodeURIComponent(datael.dataset.json));
16
+ if(!!data){
17
+ testel.innerHTML+=data.test
18
+ }
19
+ var evt = document.createEvent("Event")
20
+ evt.initEvent('test', true, true);
21
+ document.dispatchEvent(evt);
22
+ })()
23
+ </script>
24
+ </body>
25
+ </html>
26
+
@@ -0,0 +1 @@
1
+ phantomjs "$(pwd)/staticize.js" "$(pwd)/test.html" $1 $2
@@ -1,3 +1,3 @@
1
1
  module GhostInThePost
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- ghost_in_the_post (0.0.12)
4
+ ghost_in_the_post (0.0.13)
5
5
  nokogiri
6
6
  rails (~> 4.2.3)
7
7
 
@@ -13,4 +13,9 @@ class Mailer < ActionMailer::Base
13
13
  end
14
14
  end
15
15
 
16
+ def timeout
17
+ set_ghost_timeout 60000
18
+ mail(to: 'example@example.org', subject: "Notification for you")
19
+ end
20
+
16
21
  end
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <%= javascript_include_tag "application" %>
5
+ </head>
6
+ <body>
7
+ <div id="json" data-json="<%= {key: "value", test: [:one, :two, :three]}.to_json %>"></div>
8
+ <span><%= "This makes sure it is preprocessed" %></span>
9
+ <div id="test"></div>
10
+ <script> //to be removed </script>
11
+ </body>
12
+ </html>
13
+
@@ -641,3 +641,21 @@ Mailer#normal: processed outbound mail in 130.6ms
641
641
  Rendered mailer/normal.html.erb (97.2ms)
642
642
 
643
643
  Mailer#normal: processed outbound mail in 113.4ms
644
+ Rendered mailer/normal.html.erb (335.7ms)
645
+
646
+ Mailer#normal: processed outbound mail in 680.2ms
647
+ Rendered mailer/normal.html.erb (5.1ms)
648
+
649
+ Mailer#normal: processed outbound mail in 19.8ms
650
+ Rendered mailer/normal.html.erb (4.1ms)
651
+
652
+ Mailer#normal: processed outbound mail in 18.3ms
653
+ Rendered mailer/normal.html.erb (9.0ms)
654
+
655
+ Mailer#normal: processed outbound mail in 25.6ms
656
+ Rendered mailer/normal.html.erb (5.5ms)
657
+
658
+ Mailer#normal: processed outbound mail in 20.2ms
659
+ Rendered mailer/normal.html.erb (240.5ms)
660
+
661
+ Mailer#normal: processed outbound mail in 518.2ms
@@ -0,0 +1 @@
1
+ I"�app/assets/javascripts/application.js?type=application/javascript&id=6b9ad9dbf06952f19c1541462386f9bed811e9f954373a87551f72dc15e658cf:ET
@@ -0,0 +1 @@
1
+ "%����Bpn�uی��s-��#-=���E���
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ghost_in_the_post
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Anema
@@ -98,6 +98,8 @@ files:
98
98
  - lib/ghost_in_the_post/mail_ghost.rb
99
99
  - lib/ghost_in_the_post/mailer.rb
100
100
  - lib/ghost_in_the_post/phantom/staticize.js
101
+ - lib/ghost_in_the_post/phantom/test.html
102
+ - lib/ghost_in_the_post/phantom/test.sh
101
103
  - lib/ghost_in_the_post/phantom_transform.rb
102
104
  - lib/ghost_in_the_post/version.rb
103
105
  - spec/dummy/Gemfile
@@ -108,6 +110,7 @@ files:
108
110
  - spec/dummy/app/views/mailer/multi.html
109
111
  - spec/dummy/app/views/mailer/multi.text
110
112
  - spec/dummy/app/views/mailer/normal.html.erb
113
+ - spec/dummy/app/views/mailer/timeout.html.erb
111
114
  - spec/dummy/bin/bundle
112
115
  - spec/dummy/bin/rails
113
116
  - spec/dummy/bin/rake
@@ -169,6 +172,7 @@ files:
169
172
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/An2BqgCUu8CzOKe-VSnoXczbRwI8Ap9AzhLc1azFwQM.cache
170
173
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/BMI0IB92xLhvUPcr_K0JuSk8zczmrEEbJCd3qwHauhQ.cache
171
174
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/BcPdraTPmLdHSun4O7BnjZ6ufaKCVbBRvms-82qCluA.cache
175
+ - spec/dummy/tmp/cache/assets/sprockets/v3.0/CFce4mUn3NKfxudAMjGimWmh7o3Ld0S6FG3RubLSfY0.cache
172
176
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/CLll3B8DlG_2J0DLaC2sufKgEn_AmpxRV3x68HKgzOo.cache
173
177
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/D-HKmsnMBra3DrQsvr9VDAFpa_ufsdIT2IoUTH6wwkk.cache
174
178
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/DwD6zrfzwxt1374jnxC2oVe7gGgBufFbG-J2O6rrueY.cache
@@ -283,7 +287,9 @@ files:
283
287
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/orojWnvYjvANZxZ9nlW90sFI9a8FVmGhXIH-yrTJosw.cache
284
288
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/pBz1axMxwP5OyxtH8SiPKPiCFJM-bpqU-uRX6wnnxuw.cache
285
289
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache
290
+ - spec/dummy/tmp/cache/assets/sprockets/v3.0/pghFF9xNT5BvjLidDtSmU6dvSgCVn-iin38dO-Kj0Yg.cache
286
291
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/qDnHFwq1UkAWx061g5XNrYS1YlZ9-F75hGKN5h4J7zo.cache
292
+ - spec/dummy/tmp/cache/assets/sprockets/v3.0/qEyZquti62cZfUC7g5M8wPmKI8QFD1TcAP25xKH6nuA.cache
287
293
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/qxbw0jMkxTNeM5T2QovOD9vTyvjHVjBN5tZdwBf519A.cache
288
294
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/rPUhlty9Mb_NClEXkrTdgZf7RmfP8mBCaJikSbtiL9I.cache
289
295
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/rRRUxSpuJVB_yLwUZ2vy6LqXvSnZe6VdRcLlfHUEppA.cache
@@ -346,6 +352,7 @@ test_files:
346
352
  - spec/dummy/app/views/mailer/multi.html
347
353
  - spec/dummy/app/views/mailer/multi.text
348
354
  - spec/dummy/app/views/mailer/normal.html.erb
355
+ - spec/dummy/app/views/mailer/timeout.html.erb
349
356
  - spec/dummy/bin/bundle
350
357
  - spec/dummy/bin/rails
351
358
  - spec/dummy/bin/rake
@@ -423,6 +430,7 @@ test_files:
423
430
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/bPidbeprQMmulDZcvmlovBWdTdDpfStDQJkTDKSq6Ok.cache
424
431
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/bUkzCcGSA0tIibGD0LUs8Dx7qPVSR3DW0R28xQxQZU0.cache
425
432
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/c9FtssUn8IBUX0G0uuMh5yzIzNVivjgODFVQgFeEpzY.cache
433
+ - spec/dummy/tmp/cache/assets/sprockets/v3.0/CFce4mUn3NKfxudAMjGimWmh7o3Ld0S6FG3RubLSfY0.cache
426
434
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/ch4kKrWuBlXSqDtB3SOIqo7UitKlIsPb_prvMi9Mih8.cache
427
435
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/CLll3B8DlG_2J0DLaC2sufKgEn_AmpxRV3x68HKgzOo.cache
428
436
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/cQ32JvqbsXa5gTruc7Rx0g8qjxG4LhyIzg-UaJ5NXZE.cache
@@ -504,9 +512,11 @@ test_files:
504
512
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/P9j2l4S56s1iC4EHIXt0kQuovTyGOPXxqpnrHAGMC48.cache
505
513
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/pBz1axMxwP5OyxtH8SiPKPiCFJM-bpqU-uRX6wnnxuw.cache
506
514
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache
515
+ - spec/dummy/tmp/cache/assets/sprockets/v3.0/pghFF9xNT5BvjLidDtSmU6dvSgCVn-iin38dO-Kj0Yg.cache
507
516
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/Q5jtbm8IDgytmUYx2yDM4wdqpIeUGokl32mrR0IXY7c.cache
508
517
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/Qc7QfVQbYBWImd4qzsUG8Cf9iQVl6DDqk3y88gD8qQU.cache
509
518
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/qDnHFwq1UkAWx061g5XNrYS1YlZ9-F75hGKN5h4J7zo.cache
519
+ - spec/dummy/tmp/cache/assets/sprockets/v3.0/qEyZquti62cZfUC7g5M8wPmKI8QFD1TcAP25xKH6nuA.cache
510
520
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/qxbw0jMkxTNeM5T2QovOD9vTyvjHVjBN5tZdwBf519A.cache
511
521
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/R4Kd0Ziop2FO2-krxapt2pImoTbuIO4HkWRn3pJ0Gyk.cache
512
522
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/R5bZok5iFwiJM4BO_xss25_ODJU7-wHV09HU2RFx7rI.cache