cartero 0.0.1 → 0.0.2
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/lib/cartero/document.rb +7 -10
- data/lib/cartero/version.rb +1 -1
- data/test/lib/cartero/document_test.rb +1 -4
- metadata +1 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7a35e28ca62b224a8ea2e564e672a18dc0e2995a
|
|
4
|
+
data.tar.gz: 3fbf78488e423351e7843d5304b3f0e2d34eb7ff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ab927b62d6141b17111f1cf53bf0996e1a5286c4f492d245fc8933fbc0eb4361f66f258220a7789c1cddbd993c69d19bd6bcf5546aa88a71448107c64ad0d7ec
|
|
7
|
+
data.tar.gz: 1b67a65f5bd44985d513a83a0755382dec042b4e28e77f6e3af7b9c14a7433b6ce606dfc1bea4d5a4b9889264d53c41c1a26b3fa64bc3fbe0d6aab336cda23cc
|
data/lib/cartero/document.rb
CHANGED
|
@@ -12,15 +12,20 @@ module Cartero
|
|
|
12
12
|
@original_html = File.read path
|
|
13
13
|
@original_path = path
|
|
14
14
|
@processed = {}
|
|
15
|
-
|
|
15
|
+
premailer
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def premailer
|
|
19
19
|
response = Net::HTTP.post_form(
|
|
20
20
|
@@premailer_uri,
|
|
21
|
-
{
|
|
21
|
+
{
|
|
22
|
+
html: @original_html,
|
|
23
|
+
adapter: "nokogiri",
|
|
24
|
+
preserve_styles: false
|
|
25
|
+
}
|
|
22
26
|
)
|
|
23
27
|
documents = JSON.parse(response.body)['documents']
|
|
28
|
+
puts documents
|
|
24
29
|
premailer_html_url = documents['html']
|
|
25
30
|
premailer_text_url = documents['txt']
|
|
26
31
|
|
|
@@ -29,20 +34,12 @@ module Cartero
|
|
|
29
34
|
end
|
|
30
35
|
|
|
31
36
|
def save_processed_html path
|
|
32
|
-
if @processed[:html] == nil
|
|
33
|
-
premailer
|
|
34
|
-
end
|
|
35
|
-
|
|
36
37
|
File.open(File.expand_path(path), 'wb') do |f|
|
|
37
38
|
f.write @processed[:html]
|
|
38
39
|
end
|
|
39
40
|
end
|
|
40
41
|
|
|
41
42
|
def save_processed_text path
|
|
42
|
-
if @processed[:text] == nil
|
|
43
|
-
premailer
|
|
44
|
-
end
|
|
45
|
-
|
|
46
43
|
File.open(File.expand_path(path), 'wb') do |f|
|
|
47
44
|
f.write @processed[:text]
|
|
48
45
|
end
|
data/lib/cartero/version.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require_relative '../../test_helper'
|
|
2
2
|
|
|
3
3
|
describe Cartero::Document do
|
|
4
|
-
before do
|
|
4
|
+
before :all do
|
|
5
5
|
@path = File.expand_path 'test/fixtures/31_140311.html'
|
|
6
6
|
@doc = Cartero::Document.new @path
|
|
7
7
|
end
|
|
@@ -19,9 +19,6 @@ describe Cartero::Document do
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
describe '#premailer' do
|
|
22
|
-
before :all do
|
|
23
|
-
@doc.premailer
|
|
24
|
-
end
|
|
25
22
|
|
|
26
23
|
it 'sets processed[:html] to the premailer HTML' do
|
|
27
24
|
#@doc.processed[:html].must_equal File.read File.expand_path('test/fixtures/31_140311-premailer.html')
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cartero
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adam Dawkins
|
|
@@ -76,7 +76,6 @@ files:
|
|
|
76
76
|
- test/fixtures/premailer_2.html
|
|
77
77
|
- test/lib/cartero/document_test.rb
|
|
78
78
|
- test/lib/cartero/version_test.rb
|
|
79
|
-
- test/output/new_premailer_test.html
|
|
80
79
|
- test/test_helper.rb
|
|
81
80
|
homepage: ''
|
|
82
81
|
licenses:
|
|
@@ -109,5 +108,4 @@ test_files:
|
|
|
109
108
|
- test/fixtures/premailer_2.html
|
|
110
109
|
- test/lib/cartero/document_test.rb
|
|
111
110
|
- test/lib/cartero/version_test.rb
|
|
112
|
-
- test/output/new_premailer_test.html
|
|
113
111
|
- test/test_helper.rb
|