roadie 1.0.0 → 1.0.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.
- data/Gemfile.lock +4 -7
- data/README.textile +2 -0
- data/lib/roadie/inliner.rb +5 -2
- data/lib/roadie/version.rb +1 -1
- data/roadie.gemspec +1 -1
- data/spec/lib/roadie/inliner_spec.rb +7 -2
- metadata +5 -32
data/Gemfile.lock
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
roadie (1.0.0
|
4
|
+
roadie (1.0.0)
|
5
5
|
actionmailer (~> 3.0.0)
|
6
6
|
css_parser
|
7
|
-
nokogiri
|
7
|
+
nokogiri (>= 1.4.4)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: http://rubygems.org/
|
@@ -29,12 +29,12 @@ GEM
|
|
29
29
|
i18n (~> 0.4)
|
30
30
|
activesupport (3.0.3)
|
31
31
|
builder (2.1.2)
|
32
|
-
css_parser (1.1.
|
32
|
+
css_parser (1.1.9)
|
33
33
|
diff-lcs (1.1.2)
|
34
34
|
erubis (2.6.6)
|
35
35
|
abstract (>= 1.0.0)
|
36
36
|
i18n (0.5.0)
|
37
|
-
mail (2.2.
|
37
|
+
mail (2.2.19)
|
38
38
|
activesupport (>= 2.3.6)
|
39
39
|
i18n (>= 0.4.0)
|
40
40
|
mime-types (~> 1.16)
|
@@ -75,8 +75,5 @@ PLATFORMS
|
|
75
75
|
ruby
|
76
76
|
|
77
77
|
DEPENDENCIES
|
78
|
-
actionmailer (~> 3.0.0)
|
79
|
-
css_parser
|
80
|
-
nokogiri
|
81
78
|
roadie!
|
82
79
|
rspec-rails (>= 2.0.0)
|
data/README.textile
CHANGED
data/lib/roadie/inliner.rb
CHANGED
@@ -78,10 +78,12 @@ module Roadie
|
|
78
78
|
document.at_css('html').children.before(head)
|
79
79
|
end
|
80
80
|
|
81
|
+
# This is handled automatically by Nokogiri in Ruby 1.9, IF charset of string != utf-8
|
82
|
+
# We want UTF-8 to be specified as well, so we still do this.
|
81
83
|
unless document.at_css('html > head > meta[http-equiv=Content-Type]')
|
82
84
|
meta = Nokogiri::XML::Node.new('meta', document)
|
83
85
|
meta['http-equiv'] = 'Content-Type'
|
84
|
-
meta['content'] = 'text/html; charset=
|
86
|
+
meta['content'] = 'text/html; charset=UTF-8'
|
85
87
|
head.add_child(meta)
|
86
88
|
end
|
87
89
|
end
|
@@ -167,10 +169,11 @@ module Roadie
|
|
167
169
|
|
168
170
|
def absolute_url_base(base_path)
|
169
171
|
return nil unless url_options
|
172
|
+
port = url_options[:port]
|
170
173
|
URI::Generic.build({
|
171
174
|
:scheme => url_options[:protocol] || 'http',
|
172
175
|
:host => url_options[:host],
|
173
|
-
:port =>
|
176
|
+
:port => (port ? port.to_i : nil),
|
174
177
|
:path => base_path
|
175
178
|
})
|
176
179
|
end
|
data/lib/roadie/version.rb
CHANGED
data/roadie.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.summary = %q{Making HTML emails comfortable for the Rails rockstars}
|
15
15
|
s.description = %q{Roadie tries to make sending HTML emails a little less painful in Rails 3 by inlining stylesheets and rewrite relative URLs for you.}
|
16
16
|
|
17
|
-
s.add_dependency 'nokogiri'
|
17
|
+
s.add_dependency 'nokogiri', '>= 1.4.4'
|
18
18
|
s.add_dependency 'css_parser'
|
19
19
|
s.add_dependency 'actionmailer', '~> 3.0.0'
|
20
20
|
|
@@ -1,9 +1,11 @@
|
|
1
|
+
# encoding: UTF-8
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Roadie::Inliner do
|
4
5
|
def use_css(css); @css = css; end
|
5
6
|
def rendering(html, options = {})
|
6
|
-
|
7
|
+
url_options = options.fetch(:url_options, {:host => 'example.com'})
|
8
|
+
Nokogiri::HTML.parse Roadie::Inliner.new(@css, html, url_options).execute
|
7
9
|
end
|
8
10
|
|
9
11
|
describe "inlining styles" do
|
@@ -207,7 +209,10 @@ describe Roadie::Inliner do
|
|
207
209
|
end
|
208
210
|
|
209
211
|
it "should insert meta tag describing content-type" do
|
210
|
-
rendering('<html><head></head><body></body></html>').
|
212
|
+
rendering('<html><head></head><body></body></html>').tap do |document|
|
213
|
+
document.should have_selector('head meta[http-equiv="Content-Type"]')
|
214
|
+
document.css('head meta[http-equiv="Content-Type"]').first['content'].should == 'text/html; charset=UTF-8'
|
215
|
+
end
|
211
216
|
end
|
212
217
|
|
213
218
|
it "should not insert duplicate meta tags describing content-type" do
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roadie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 0
|
10
|
-
version: 1.0.0
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.1
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Magnus Bergmark
|
@@ -15,7 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date: 2011-
|
13
|
+
date: 2011-06-14 00:00:00 +02:00
|
19
14
|
default_executable:
|
20
15
|
dependencies:
|
21
16
|
- !ruby/object:Gem::Dependency
|
@@ -26,10 +21,7 @@ dependencies:
|
|
26
21
|
requirements:
|
27
22
|
- - ">="
|
28
23
|
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
24
|
+
version: 1.4.4
|
33
25
|
type: :runtime
|
34
26
|
version_requirements: *id001
|
35
27
|
- !ruby/object:Gem::Dependency
|
@@ -40,9 +32,6 @@ dependencies:
|
|
40
32
|
requirements:
|
41
33
|
- - ">="
|
42
34
|
- !ruby/object:Gem::Version
|
43
|
-
hash: 3
|
44
|
-
segments:
|
45
|
-
- 0
|
46
35
|
version: "0"
|
47
36
|
type: :runtime
|
48
37
|
version_requirements: *id002
|
@@ -54,11 +43,6 @@ dependencies:
|
|
54
43
|
requirements:
|
55
44
|
- - ~>
|
56
45
|
- !ruby/object:Gem::Version
|
57
|
-
hash: 7
|
58
|
-
segments:
|
59
|
-
- 3
|
60
|
-
- 0
|
61
|
-
- 0
|
62
46
|
version: 3.0.0
|
63
47
|
type: :runtime
|
64
48
|
version_requirements: *id003
|
@@ -70,11 +54,6 @@ dependencies:
|
|
70
54
|
requirements:
|
71
55
|
- - ">="
|
72
56
|
- !ruby/object:Gem::Version
|
73
|
-
hash: 15
|
74
|
-
segments:
|
75
|
-
- 2
|
76
|
-
- 0
|
77
|
-
- 0
|
78
57
|
version: 2.0.0
|
79
58
|
type: :development
|
80
59
|
version_requirements: *id004
|
@@ -134,23 +113,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
134
113
|
requirements:
|
135
114
|
- - ">="
|
136
115
|
- !ruby/object:Gem::Version
|
137
|
-
hash: 3
|
138
|
-
segments:
|
139
|
-
- 0
|
140
116
|
version: "0"
|
141
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
118
|
none: false
|
143
119
|
requirements:
|
144
120
|
- - ">="
|
145
121
|
- !ruby/object:Gem::Version
|
146
|
-
hash: 3
|
147
|
-
segments:
|
148
|
-
- 0
|
149
122
|
version: "0"
|
150
123
|
requirements: []
|
151
124
|
|
152
125
|
rubyforge_project:
|
153
|
-
rubygems_version: 1.
|
126
|
+
rubygems_version: 1.6.2
|
154
127
|
signing_key:
|
155
128
|
specification_version: 3
|
156
129
|
summary: Making HTML emails comfortable for the Rails rockstars
|