ghost_in_the_post 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8fdee37440de2543663fe6262bbb9462814f01dd
4
- data.tar.gz: 015968eca2634d160b1902de601061f3c7538e6f
3
+ metadata.gz: 4442c56e3bd559e589174e9fc8cd8d490ccb3fe7
4
+ data.tar.gz: d091d8f5a65162c29a9418de54c41d814b990704
5
5
  SHA512:
6
- metadata.gz: 2aadad0634b972c587c121282b199f53820300a91d1fb950aa2fc2b3ea3c3bbfbf7cbca9aee87c8da2fd05f47952c9c2283c6782205fb43a0831c51470c412b9
7
- data.tar.gz: f34444669b33981f2057279e08c637cd168a4bc0c1d3aa18a060fbfe3066292ea2aad7b75a42850f04e6a0a74b82a713910c1aeb980a9e4353bc4715bd136876
6
+ metadata.gz: 9ef492120d023623c4364f722f0758b60fb4b57e43298072d1db631caec0991590356aff844af180c855080e3a5eb2c6c4fcf150d312c566954ee987c603bc85
7
+ data.tar.gz: 63ef4942ee7dc18ad146a1455d460ed7c0e8066a469a2f953c4605d21b9076a4aec121ddb9ae65d7d93643428cbb65f4ce850794e12e7299b71030283cda262c
@@ -1,21 +1,10 @@
1
1
  module GhostInThePost
2
2
  module Automatic
3
- attr_accessor :included_scripts, :ghost_timeout, :ghost_wait_event
4
-
5
- def include_script(*paths)
6
- @included_scripts ||= []
7
- @included_scripts += paths
8
- end
9
-
3
+ include Mailer
10
4
  def mail(*args, &block)
11
5
  super.tap do |email|
12
- email.extend GhostOnCommand
13
6
  email.extend GhostOnDelivery
14
- email.included_scripts = @included_scripts
15
- email.ghost_timeout = @ghost_timeout
16
- email.ghost_wait_event = @ghost_wait_event
17
7
  end
18
8
  end
19
-
20
9
  end
21
10
  end
@@ -1,20 +1,26 @@
1
1
  module GhostInThePost
2
2
  module Mailer
3
- attr_accessor :included_scripts, :ghost_timeout, :ghost_wait_event
4
3
 
5
4
  def include_script(*paths)
6
5
  @included_scripts ||= []
7
6
  @included_scripts += paths
8
7
  end
9
8
 
9
+ def set_ghost_timeout timeout
10
+ @ghost_timeout = timeout
11
+ end
12
+
13
+ def set_ghost_wait_event wait_event
14
+ @ghost_wait_event = wait_event
15
+ end
16
+
10
17
  def mail(*args, &block)
11
18
  super.tap do |email|
12
19
  email.extend GhostOnCommand
13
- email.included_scripts = included_scripts
20
+ email.included_scripts = @included_scripts
14
21
  email.ghost_timeout = @ghost_timeout
15
22
  email.ghost_wait_event = @ghost_wait_event
16
23
  end
17
24
  end
18
-
19
25
  end
20
26
  end
@@ -7,6 +7,7 @@ var system = require('system'),
7
7
  timeout = parseInt(system.args[4]) || 1000, //return page contents after a timeout
8
8
  wait_event = system.args[5]; //return page contents after an event
9
9
 
10
+ console.log(timeout)
10
11
  //write out to console to export contents
11
12
  //and get out of here
12
13
  function finish(){
@@ -14,7 +14,6 @@ module GhostInThePost
14
14
  begin
15
15
  htmlfile = html_file()
16
16
  jsfile = js_file()
17
- p command(htmlfile, jsfile)
18
17
  output = IO.popen(command(htmlfile, jsfile)){|io| io.read}
19
18
  ensure
20
19
  htmlfile.unlink unless htmlfile.nil?
@@ -1,3 +1,3 @@
1
1
  module GhostInThePost
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- ghost_in_the_post (0.0.1)
4
+ ghost_in_the_post (0.0.2)
5
5
  rails (~> 4.2.3)
6
6
 
7
7
  GEM
@@ -4,6 +4,8 @@ class AutoMailer < ActionMailer::Base
4
4
  default from: 'john@example.com'
5
5
 
6
6
  def normal_email
7
+ set_ghost_timeout 5000
8
+ include_script "test"
7
9
  mail(to: 'example@example.org', subject: "Notification for you") do |format|
8
10
  format.html { render :normal_email }
9
11
  format.text { render :normal_email }
@@ -270,3 +270,59 @@ AutoMailer#normal_email: processed outbound mail in 180.1ms
270
270
  Rendered auto_mailer/normal_email.text (0.3ms)
271
271
 
272
272
  AutoMailer#normal_email: processed outbound mail in 224.1ms
273
+ Rendered auto_mailer/normal_email.html.erb (1.8ms)
274
+ Rendered auto_mailer/normal_email.text (0.7ms)
275
+
276
+ AutoMailer#normal_email: processed outbound mail in 208.3ms
277
+ Rendered auto_mailer/normal_email.html.erb (1.4ms)
278
+ Rendered auto_mailer/normal_email.text (0.3ms)
279
+
280
+ AutoMailer#normal_email: processed outbound mail in 185.6ms
281
+ Rendered auto_mailer/normal_email.html.erb (1.5ms)
282
+ Rendered auto_mailer/normal_email.text (0.3ms)
283
+
284
+ AutoMailer#normal_email: processed outbound mail in 187.4ms
285
+ Rendered auto_mailer/normal_email.html.erb (1.4ms)
286
+ Rendered auto_mailer/normal_email.text (0.3ms)
287
+
288
+ AutoMailer#normal_email: processed outbound mail in 191.5ms
289
+ Rendered auto_mailer/normal_email.html.erb (1.4ms)
290
+ Rendered auto_mailer/normal_email.text (0.7ms)
291
+
292
+ AutoMailer#normal_email: processed outbound mail in 185.1ms
293
+ Rendered auto_mailer/normal_email.html.erb (1.4ms)
294
+ Rendered auto_mailer/normal_email.text (0.3ms)
295
+
296
+ AutoMailer#normal_email: processed outbound mail in 197.7ms
297
+ Rendered auto_mailer/normal_email.html.erb (2.1ms)
298
+ Rendered auto_mailer/normal_email.text (0.5ms)
299
+
300
+ AutoMailer#normal_email: processed outbound mail in 219.7ms
301
+ Rendered auto_mailer/normal_email.html.erb (1.4ms)
302
+ Rendered auto_mailer/normal_email.text (0.3ms)
303
+
304
+ AutoMailer#normal_email: processed outbound mail in 195.1ms
305
+
306
+ AutoMailer#normal_email: processed outbound mail in 0.5ms
307
+
308
+ AutoMailer#normal_email: processed outbound mail in 0.5ms
309
+
310
+ AutoMailer#normal_email: processed outbound mail in 0.6ms
311
+
312
+ AutoMailer#normal_email: processed outbound mail in 0.4ms
313
+ Rendered auto_mailer/normal_email.html.erb (1.9ms)
314
+ Rendered auto_mailer/normal_email.text (0.3ms)
315
+
316
+ AutoMailer#normal_email: processed outbound mail in 219.8ms
317
+ Rendered auto_mailer/normal_email.html.erb (1.5ms)
318
+ Rendered auto_mailer/normal_email.text (0.3ms)
319
+
320
+ AutoMailer#normal_email: processed outbound mail in 195.4ms
321
+ Rendered auto_mailer/normal_email.html.erb (1.4ms)
322
+ Rendered auto_mailer/normal_email.text (0.6ms)
323
+
324
+ AutoMailer#normal_email: processed outbound mail in 203.8ms
325
+ Rendered auto_mailer/normal_email.html.erb (1.7ms)
326
+ Rendered auto_mailer/normal_email.text (0.3ms)
327
+
328
+ AutoMailer#normal_email: processed outbound mail in 217.8ms
@@ -0,0 +1,3 @@
1
+ [o:Set:
2
+ @hash{
3
+ I"environment-version:ETTI"environment-paths;TTI"Lprocessors:type=application/javascript&file_type=application/javascript;TTI"1file-digest://app/assets/javascripts/test.js;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TT
@@ -0,0 +1 @@
1
+ I"~app/assets/javascripts/test.js?type=application/javascript&id=7eb9be9209046e35d5dfd7cc9703565810b0bcf4bf54f62264334cc68f750bea:ET
@@ -3,40 +3,15 @@ require 'mail'
3
3
 
4
4
  module GhostInThePost
5
5
  describe Automatic do
6
- class AutoMailer < BaseMailer
7
- include Automatic
8
- end
9
-
10
6
  let(:email) { Mail.new(to: "foo@example.com", from: "me@example.com") }
11
7
  let(:instance) { AutoMailer.new(email) }
12
-
13
- describe "#include_script" do
14
-
15
- it "should add to include scripts" do
16
- instance.include_script "test.js"
17
- expect(instance.included_scripts).to eq(["test.js"])
18
- end
19
- end
20
-
21
8
  describe "#mail" do
22
9
  it "should return an email" do
23
10
  expect(instance.mail).to be_kind_of(Mail::Message)
24
11
  end
25
-
26
12
  it "should return an email extended with GhostOnCommand and GhostOnDelivery" do
27
- expect(email).to receive(:extend).with(GhostOnCommand).and_call_original
28
- expect(email).to receive(:extend).with(GhostOnDelivery).and_call_original
29
- mail = instance.mail
30
- expect(mail).to be_kind_of(GhostOnCommand)
31
- expect(mail).to be_kind_of(GhostOnDelivery)
32
- end
33
-
34
- it "should have set the emails included scripts" do
35
- email.extend GhostOnCommand
36
- expect(email).to receive(:included_scripts=).with(nil).and_call_original
37
- instance.mail
13
+ expect(instance.mail).to be_kind_of(GhostOnDelivery)
38
14
  end
39
15
  end
40
-
41
16
  end
42
17
  end
@@ -4,35 +4,40 @@ require 'mail'
4
4
  module GhostInThePost
5
5
  describe Mailer do
6
6
  let(:email) { Mail.new(to: "foo@example.com", from: "me@example.com") }
7
- let(:instance) { AutoMailer.new(email) }
8
-
7
+ let(:instance) { SomeMailer.new(email) }
9
8
  describe "#include_script" do
10
-
11
9
  it "should add to include scripts" do
12
10
  instance.include_script "test.js"
13
- expect(instance.included_scripts).to eq(["test.js"])
11
+ expect(instance.instance_variable_get(:@included_scripts)).to eq(["test.js"])
12
+ instance.include_script "foo.js"
13
+ expect(instance.instance_variable_get(:@included_scripts)).to eq(["test.js", "foo.js"])
14
+ end
15
+ end
16
+ describe "#set_ghost_timeout" do
17
+ it "should set the timeout" do
18
+ instance.set_ghost_timeout 42
19
+ expect(instance.instance_variable_get(:@ghost_timeout)).to eq(42)
20
+ end
21
+ end
22
+ describe "#set_ghost_wait_event" do
23
+ it "should set the wait_event" do
24
+ instance.set_ghost_wait_event "doo:doo"
25
+ expect(instance.instance_variable_get(:@ghost_wait_event)).to eq("doo:doo")
14
26
  end
15
27
  end
16
-
17
28
  describe "#mail" do
18
29
  it "should return an email" do
19
30
  expect(instance.mail).to be_kind_of(Mail::Message)
20
31
  end
21
-
22
32
  it "should return an email extended with GhostOnCommand and GhostOnDelivery" do
23
- expect(email).to receive(:extend).with(GhostOnCommand).and_call_original
24
- expect(email).to receive(:extend).with(GhostOnDelivery).and_call_original
25
- mail = instance.mail
26
- expect(mail).to be_kind_of(GhostOnCommand)
27
- expect(mail).to be_kind_of(GhostOnDelivery)
33
+ expect(instance.mail).to be_kind_of(GhostOnCommand)
28
34
  end
29
-
30
- it "should have set the emails included scripts" do
31
- email.extend GhostOnCommand
32
- expect(email).to receive(:included_scripts=).with(nil).and_call_original
35
+ it "should have set the emails variables" do
36
+ expect(email).to receive(:included_scripts=)
37
+ expect(email).to receive(:ghost_timeout=)
38
+ expect(email).to receive(:ghost_wait_event=)
33
39
  instance.mail
34
40
  end
35
41
  end
36
-
37
42
  end
38
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ghost_in_the_post
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Anema
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-03 00:00:00.000000000 Z
11
+ date: 2016-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -136,13 +136,16 @@ files:
136
136
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/_HO5Nyj_TzTxVwa4OOf_0UJfBCmjgkv7NsRU29AD5Oo.cache
137
137
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/eN_ueL7m-D9xkEZpaLKwCxdrNzyz-MW9jcdJ5TdF9j8.cache
138
138
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/efKfhZKxLC7ERXlMb5CQMqYwbvWS-A--pH-0fqzvRiQ.cache
139
+ - spec/dummy/tmp/cache/assets/sprockets/v3.0/fQswKiWgHSxfd0vnhvPwkwh9wGIZTBu3yR03l3nv7CM.cache
139
140
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/goEv0RKoifagsjFSdEHY-23E9ybQn_t1HHEZq7PlKQI.cache
140
141
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache
141
142
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/n6_6RjvPX2rCv5dytbSnnDrGwAj1ZcPfninuNUeP_iE.cache
142
143
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/nXo-w2o4zQBM_uSUnniuP53t5erBbSZPecMED9YnzQI.cache
144
+ - spec/dummy/tmp/cache/assets/sprockets/v3.0/neKnx0KmAGPHELnZcml6jS-4_cwZbB1Oge9c5t2l0gY.cache
143
145
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/oB1njyQ78MOMRf_5TvuYzHleeI8eke5-FDIIVl7qas0.cache
144
146
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache
145
147
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/qxbw0jMkxTNeM5T2QovOD9vTyvjHVjBN5tZdwBf519A.cache
148
+ - spec/dummy/tmp/cache/assets/sprockets/v3.0/sQHPafPr1hZ7n-WhjqwFB8eUR8I1YOa1yeg0-yNdc0U.cache
146
149
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/xstXMnjOlL2Ynn6MaI9bxlRnhTPYdgCIeOWnWphFSlA.cache
147
150
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/y98HqYF9nxOk8t_j3BKv9Nc4LuSAEzhER7rCCvOM6xI.cache
148
151
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/zRSH1x7PsiRf9MSILPhc4GKDjRo4xaFNd41wHFCtJSo.cache
@@ -223,6 +226,7 @@ test_files:
223
226
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/BMI0IB92xLhvUPcr_K0JuSk8zczmrEEbJCd3qwHauhQ.cache
224
227
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/efKfhZKxLC7ERXlMb5CQMqYwbvWS-A--pH-0fqzvRiQ.cache
225
228
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/eN_ueL7m-D9xkEZpaLKwCxdrNzyz-MW9jcdJ5TdF9j8.cache
229
+ - spec/dummy/tmp/cache/assets/sprockets/v3.0/fQswKiWgHSxfd0vnhvPwkwh9wGIZTBu3yR03l3nv7CM.cache
226
230
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/goEv0RKoifagsjFSdEHY-23E9ybQn_t1HHEZq7PlKQI.cache
227
231
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/GtqgDsC0JMsKfj0x5uQrbPcSS3QIPIzLKrq2fGJDBf0.cache
228
232
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache
@@ -230,6 +234,7 @@ test_files:
230
234
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/J_D4gpddr1KPVysTvEE48iHsNzrL5Pbj8S5ZNt3PhA4.cache
231
235
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/Lc8lcXR-AibSZCIbx_imdfIOmD-zbZ_pwSNMs0o0Dos.cache
232
236
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/n6_6RjvPX2rCv5dytbSnnDrGwAj1ZcPfninuNUeP_iE.cache
237
+ - spec/dummy/tmp/cache/assets/sprockets/v3.0/neKnx0KmAGPHELnZcml6jS-4_cwZbB1Oge9c5t2l0gY.cache
233
238
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/nXo-w2o4zQBM_uSUnniuP53t5erBbSZPecMED9YnzQI.cache
234
239
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/O9gjtBITAGlfzUwc2DT5N0GW2bo2b2yQ64gnQljLogM.cache
235
240
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/oB1njyQ78MOMRf_5TvuYzHleeI8eke5-FDIIVl7qas0.cache
@@ -237,6 +242,7 @@ test_files:
237
242
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/OZ04c215C4Euu3scfhmxmte0o_tZOVWTqrv61cpy7H4.cache
238
243
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache
239
244
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/qxbw0jMkxTNeM5T2QovOD9vTyvjHVjBN5tZdwBf519A.cache
245
+ - spec/dummy/tmp/cache/assets/sprockets/v3.0/sQHPafPr1hZ7n-WhjqwFB8eUR8I1YOa1yeg0-yNdc0U.cache
240
246
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/UbKcvOd2xh3MJoKxz4l4RHMy5IupdsiDoSllZDvYCZA.cache
241
247
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/xstXMnjOlL2Ynn6MaI9bxlRnhTPYdgCIeOWnWphFSlA.cache
242
248
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/XuOqk2dVOcltjkihZ8J_u5Pbcm9Of5KFkjyihP6-5tc.cache