roadie 2.3.4 → 2.4.0

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/.gitignore CHANGED
@@ -7,4 +7,6 @@ pkg
7
7
  .idea/*
8
8
  .rvmrc
9
9
 
10
+ Gemfile.lock
10
11
  doc
12
+ tmp
@@ -1,11 +1,22 @@
1
1
  bundler_args: --without guard
2
+ before_install:
3
+ - gem install bundler --pre
2
4
 
3
5
  rvm:
4
6
  - 1.8.7
5
- - 1.9.2
6
7
  - 1.9.3
8
+ - 2.0.0
9
+ - jruby
7
10
 
8
11
  gemfile:
9
- - gemfiles/rails-3.0.gemfile
10
- - gemfiles/rails-3.1.gemfile
11
- - gemfiles/rails-3.2.gemfile
12
+ - gemfiles/rails_3.0.gemfile
13
+ - gemfiles/rails_3.1.gemfile
14
+ - gemfiles/rails_3.2.gemfile
15
+ - gemfiles/rails_4.0.gemfile
16
+
17
+ matrix:
18
+ exclude:
19
+ - rvm: 1.8.7
20
+ gemfile: gemfiles/rails_4.0.gemfile
21
+ allow_failures:
22
+ - rvm: jruby
data/Appraisals CHANGED
@@ -7,5 +7,9 @@ appraise 'rails-3.1' do
7
7
  end
8
8
 
9
9
  appraise 'rails-3.2' do
10
- gem 'rails', '~> 3.2.0.rc1'
10
+ gem 'rails', '~> 3.2.0'
11
+ end
12
+
13
+ appraise 'rails-4.0' do
14
+ gem 'rails', '~> 4.0'
11
15
  end
@@ -1,8 +1,28 @@
1
1
  ### dev
2
2
 
3
- [full changelog](https://github.com/Mange/roadie/compare/v2.3.3...master)
3
+ [full changelog](https://github.com/Mange/roadie/compare/v2.4.0...master)
4
4
 
5
- * Nothing yet
5
+ * Nothing yet.
6
+
7
+ ### 2.4.0
8
+
9
+ [full changelog](https://github.com/Mange/roadie/compare/v2.3.4...v2.4.0)
10
+
11
+ * Enhancements:
12
+ * Support Rails 4.0, with the help of:
13
+ * [Ryunosuke SATO (tricknotes)](https://github.com/tricknotes)
14
+ * [Dylan Markow](https://github.com/dmarkow)
15
+ * Keep `!important` when outputting styles to help combat web mail styles being `!important`
16
+ * Support `:nth-child`, `:last-child`, etc.
17
+ * To make this work, Roadie have to catch errors from Nokogiri and ignore them. A warning will be printed when this happens so users can open issues with the project and tests can be expanded.
18
+ * Support for custom inliner (#58) — [Harish Shetty (kandadaboggu)](https://github.com/kandadaboggu) with friends
19
+ * Bug fixes:
20
+ * Don't crash when URL options have protocols with "://" in them (#52).
21
+ * Other:
22
+ * Be more specific on which versions are required; require newer `css_parser`
23
+ * Officially support MRI 2.0.0
24
+ * Add experimental support for JRuby
25
+ * Remove documentation that talks about passing CSS filenames as symbols; unsupported in Rails 4. (Thanks to [PikachuEXE](https://github.com/PikachuEXE))
6
26
 
7
27
  ### 2.3.4
8
28
 
@@ -30,7 +50,7 @@
30
50
  [full changelog](https://github.com/Mange/roadie/compare/v2.3.1...v2.3.2)
31
51
 
32
52
  * Bug fixes:
33
- * Don't fail on selectors which start with @ (#28) [Roman Shterenzon (romanbsd)](https://github.com/romanbsd)
53
+ * Don't fail on selectors which start with @ (#28) [Roman Shterenzon (romanbsd)](https://github.com/romanbsd)
34
54
 
35
55
  ### 2.3.1
36
56
 
@@ -74,7 +94,7 @@
74
94
 
75
95
  [full changelog](https://github.com/Mange/roadie/compare/v2.1.0.pre1...v2.1.0.pre2)
76
96
 
77
- * Bug: Roadie broke url_for inside mailer views
97
+ * Bug: Roadie broke `url_for` inside mailer views
78
98
 
79
99
  ### 2.1.0.pre1
80
100
 
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
4
  group :guard do
data/Guardfile CHANGED
@@ -1,4 +1,4 @@
1
- guard 'rspec', :rvm => ['1.9.3', 'jruby-head', 'ruby-1.8.7-p358'] do
1
+ guard 'rspec' do
2
2
  watch(%r{^spec/.+_spec\.rb$})
3
3
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
4
 
data/README.md CHANGED
@@ -3,7 +3,7 @@ Roadie
3
3
 
4
4
  > Making HTML emails comfortable for the Rails rockstars
5
5
 
6
- Roadie tries to make sending HTML emails a little less painful in Rails 3 by inlining stylesheets and rewrite relative URLs for you.
6
+ Roadie tries to make sending HTML emails a little less painful in Rails 3+ by inlining stylesheets and rewrite relative URLs for you.
7
7
 
8
8
  If you want to have this in Rails 2, please see [MailStyle](https://www.github.com/purify/mail_style).
9
9
 
@@ -23,16 +23,17 @@ Build Status
23
23
 
24
24
  [![Build history and status](https://secure.travis-ci.org/Mange/roadie.png)](http://travis-ci.org/#!/Mange/roadie)
25
25
 
26
- Tested with [Travis CI](http://travis-ci.org) using the [all combinations of](http://travis-ci.org/#!/Mange/roadie):
26
+ Tested with [Travis CI](http://travis-ci.org) using [almost all combinations of](http://travis-ci.org/#!/Mange/roadie):
27
27
 
28
28
  * Ruby:
29
- * 1.8.7
30
- * 1.9.2
31
- * 1.9.3
29
+ * MRI 1.8.7
30
+ * MRI 1.9.3
31
+ * MRI 2.0.0
32
32
  * Rails
33
33
  * 3.0
34
34
  * 3.1
35
35
  * 3.2
36
+ * 4.0
36
37
 
37
38
  Let me know if you want any other combination supported officially.
38
39
 
@@ -74,6 +75,7 @@ Roadie listens to the following options (set in `Application.rb` or in your envi
74
75
  * `config.action_mailer.default_url_options` - Used for making URLs absolute.
75
76
  * `config.assets.enabled` - If the asset pipeline is turned off, Roadie will default to searching for assets in `public/stylesheets`.
76
77
  * `config.roadie.provider` - Set the provider manually, ignoring all other options. Use for advanced cases, or when you have non-default paths or other options.
78
+ * `config.roadie.after_inlining` - Set a custom inliner for the HTML document. The custom inliner in invoked after the default inliner.
77
79
 
78
80
  Usage
79
81
  -----
@@ -86,19 +88,19 @@ You can also specify the `:css` option to mailer to have it inlined automaticall
86
88
 
87
89
  ```ruby
88
90
  class Notifier < ActionMailer::Base
89
- default :css => :email, :from => 'support@mycompany.com'
91
+ default :css => 'email', :from => 'support@mycompany.com'
90
92
 
91
93
  def registration_mail
92
94
  mail(:subject => 'Welcome Aboard', :to => 'someone@example.com')
93
95
  end
94
96
 
95
97
  def newsletter
96
- mail(:subject => 'Newsletter', :to => 'someone@example.com', :css => [:email, :newsletter])
98
+ mail(:subject => 'Newsletter', :to => 'someone@example.com', :css => ['email', 'newsletter'])
97
99
  end
98
100
  end
99
101
  ```
100
102
 
101
- This will look for a css file called `email.css` in your assets. The `css` method can take either a string, a symbol or an array of both. The ".css" extension will be added automatically.
103
+ This will look for a css file called `email.css` in your assets. The `css` method can take either a string or an array of strings. The ".css" extension will be added automatically.
102
104
 
103
105
  ### Image URL rewriting ###
104
106
 
@@ -140,7 +142,7 @@ If the `link` tag uses an absolute URL to the stylesheet, it will not be inlined
140
142
  Writing your own provider
141
143
  -------------------------
142
144
 
143
- A provider handles searching CSS files for you. Cou can easily create your own provider for your specific app by subclassing `Roadie::AssetProvider`. See the API documentation for information about how to build them.
145
+ A provider handles searching CSS files for you. You can easily create your own provider for your specific app by subclassing `Roadie::AssetProvider`. See the API documentation for information about how to build them.
144
146
 
145
147
  Example Subclassing the `AssetPipelineProvider`:
146
148
 
@@ -151,11 +153,80 @@ config.roadie.provider = UserAssetsProvider.new
151
153
  # lib/user_assets_provider.rb
152
154
  class UserAssetsProvider < Roadie::AssetPipelineProvider
153
155
  def find(name)
154
- super
155
- rescue CSSFileNotFound
156
156
  user = User.find_by_name(name)
157
- raise unless user
158
- user.custom_css
157
+ if user
158
+ user.custom_css
159
+ else
160
+ super
161
+ end
162
+ end
163
+ end
164
+ ```
165
+
166
+ Writing your own inliner
167
+ -------------------------
168
+
169
+ A custom inliner transforms an outgoing HTML email using application specific rules. The custom inliner is invoked after the default inliner.
170
+
171
+ A custom inliner can be created using a `lambda` that accepts one parameter or an object that responds to the `call` method with one parameter.
172
+
173
+ Example for using lambda as custom inliner:
174
+
175
+ ```ruby
176
+ # application.rb
177
+ config.roadie.after_inlining = lambda do |document|
178
+ document.css("a#new_user").each do |link|
179
+ link['href'] = "http://www.foo.com#{link['href']}"
180
+ end
181
+ end
182
+ ```
183
+
184
+ Example for using object as custom inliner:
185
+
186
+ ```ruby
187
+ # application.rb
188
+ config.roadie.after_inlining = PromotionInliner.new
189
+
190
+ # lib/product_link_inliner.rb
191
+ class PromotionInliner
192
+ def call(document)
193
+ document.css("a.product").each do |link|
194
+ fix_link link
195
+ end
196
+ end
197
+
198
+ def fix_link(link)
199
+ if link['class'] =~ /\bsale\b/
200
+ link['href'] = link['href'] + '?source=newsletter'
201
+ end
202
+ end
203
+ end
204
+ ```
205
+
206
+ ### Custom inliner scopes
207
+
208
+ - **All HTML emails**
209
+
210
+ ```ruby
211
+ # application.rb. Custom inliner for all emails.
212
+ config.roadie.after_inlining = PromotionInliner.new
213
+ ```
214
+ - **All HTML emails sent by a mailer**
215
+
216
+ ```ruby
217
+ class MarketingMailer < ActionMailer::Base
218
+ # Custom inliner for all mailer methods.
219
+ default after_inlining: PromotionInliner.new
220
+ end
221
+ ```
222
+
223
+ - **All HTML emails sent by a specific mailer method**
224
+
225
+ ```ruby
226
+ class UserMailer < ActionMailer::Base
227
+ def registration
228
+ # Custom inliner for registration emails
229
+ mail(after_inlining: MarketingMailer.new)
159
230
  end
160
231
  end
161
232
  ```
@@ -206,10 +277,11 @@ History and contributors
206
277
  Major contributors to Roadie:
207
278
 
208
279
  * [Arttu Tervo (arttu)](https://github.com/arttu) - Original Asset pipeline support
280
+ * [Ryunosuke SATO (tricknotes)](https://github.com/tricknotes) - Initial Rails 4 support
209
281
 
210
282
  You can [see all contributors](https://github.com/Mange/roadie/contributors) on GitHub.
211
283
 
212
- This gem was originally developed for Rails 2 use on [Purify](http://purifyapp.com) under the name [MailStyle](https://www.github.com/purify/mail_style). However, the author stopped maintaining it and a fork took place to make it Rails 3 compatible.
284
+ This gem was originally developed for Rails 2 use on [Purify](http://purifyapp.com) under the name [MailStyle](https://www.github.com/purify/mail_style). However, the author stopped maintaining it and a fork took place to make it Rails 3+ compatible.
213
285
 
214
286
  The following people have contributed to the orignal gem:
215
287
 
@@ -225,7 +297,7 @@ License
225
297
 
226
298
  (The MIT License)
227
299
 
228
- Copyright (c) 2009-2011
300
+ Copyright (c) 2009-2013
229
301
 
230
302
  * [Jim Neath](http://jimneath.org)
231
303
  * Magnus Bergmark <magnus.bergmark@gmail.com>
@@ -1,6 +1,6 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source :rubygems
3
+ source "https://rubygems.org"
4
4
 
5
5
  gem "rails", "~> 3.0.0"
6
6
 
@@ -1,14 +1,14 @@
1
1
  PATH
2
- remote: .
2
+ remote: /home/mange/Projects/roadie
3
3
  specs:
4
4
  roadie (2.3.4)
5
- actionmailer (> 3.0.0, < 3.3.0)
6
- css_parser
7
- nokogiri (>= 1.4.4)
5
+ actionmailer (> 3.0.0, < 5.0.0)
6
+ css_parser (~> 1.3.4)
7
+ nokogiri (~> 1.6.0)
8
8
  sprockets
9
9
 
10
10
  GEM
11
- remote: http://rubygems.org/
11
+ remote: https://rubygems.org/
12
12
  specs:
13
13
  abstract (1.0.0)
14
14
  actionmailer (3.0.17)
@@ -37,53 +37,31 @@ GEM
37
37
  activemodel (= 3.0.17)
38
38
  activesupport (= 3.0.17)
39
39
  activesupport (3.0.17)
40
- addressable (2.3.2)
41
- appraisal (0.5.0)
40
+ addressable (2.3.5)
41
+ appraisal (0.5.1)
42
42
  bundler
43
43
  rake
44
44
  arel (2.0.10)
45
45
  builder (2.1.2)
46
- coderay (1.0.8)
47
- css_parser (1.2.6)
46
+ css_parser (1.3.4)
48
47
  addressable
49
- rdoc
50
48
  diff-lcs (1.1.3)
51
49
  erubis (2.6.6)
52
50
  abstract (>= 1.0.0)
53
- growl (1.0.3)
54
- guard (1.5.3)
55
- listen (>= 0.4.2)
56
- lumberjack (>= 1.0.2)
57
- pry (>= 0.9.10)
58
- thor (>= 0.14.6)
59
- guard-rspec (2.1.1)
60
- guard (>= 1.1)
61
- rspec (~> 2.11)
62
- hike (1.2.1)
51
+ hike (1.2.3)
63
52
  i18n (0.5.0)
64
53
  json (1.7.5)
65
- json (1.7.5-java)
66
- listen (0.5.3)
67
- lumberjack (1.0.2)
68
54
  mail (2.2.19)
69
55
  activesupport (>= 2.3.6)
70
56
  i18n (>= 0.4.0)
71
57
  mime-types (~> 1.16)
72
58
  treetop (~> 1.4.8)
73
- method_source (0.8.1)
74
59
  mime-types (1.19)
75
- multi_json (1.3.7)
76
- nokogiri (1.5.5)
60
+ mini_portile (0.5.0)
61
+ multi_json (1.7.7)
62
+ nokogiri (1.6.0)
63
+ mini_portile (~> 0.5.0)
77
64
  polyglot (0.3.3)
78
- pry (0.9.10)
79
- coderay (~> 1.0.5)
80
- method_source (~> 0.8)
81
- slop (~> 3.3.1)
82
- pry (0.9.10-java)
83
- coderay (~> 1.0.5)
84
- method_source (~> 0.8)
85
- slop (~> 3.3.1)
86
- spoon (~> 0.0)
87
65
  rack (1.2.5)
88
66
  rack-mount (0.6.14)
89
67
  rack (>= 1.0.0)
@@ -103,47 +81,43 @@ GEM
103
81
  rake (>= 0.8.7)
104
82
  rdoc (~> 3.4)
105
83
  thor (~> 0.14.4)
106
- rake (0.9.2.2)
107
- rb-fsevent (0.9.2)
84
+ rake (10.0.2)
108
85
  rdoc (3.12)
109
86
  json (~> 1.4)
110
- rspec (2.11.0)
111
- rspec-core (~> 2.11.0)
112
- rspec-expectations (~> 2.11.0)
113
- rspec-mocks (~> 2.11.0)
114
- rspec-core (2.11.1)
115
- rspec-expectations (2.11.3)
87
+ rspec (2.12.0)
88
+ rspec-core (~> 2.12.0)
89
+ rspec-expectations (~> 2.12.0)
90
+ rspec-mocks (~> 2.12.0)
91
+ rspec-core (2.12.1)
92
+ rspec-expectations (2.12.0)
116
93
  diff-lcs (~> 1.1.3)
117
- rspec-mocks (2.11.3)
118
- rspec-rails (2.11.4)
94
+ rspec-mocks (2.12.0)
95
+ rspec-rails (2.12.0)
119
96
  actionpack (>= 3.0)
120
97
  activesupport (>= 3.0)
121
98
  railties (>= 3.0)
122
- rspec (~> 2.11.0)
123
- slop (3.3.3)
124
- spoon (0.0.1)
125
- sprockets (2.8.1)
99
+ rspec-core (~> 2.12.0)
100
+ rspec-expectations (~> 2.12.0)
101
+ rspec-mocks (~> 2.12.0)
102
+ sprockets (2.10.0)
126
103
  hike (~> 1.2)
127
104
  multi_json (~> 1.0)
128
105
  rack (~> 1.0)
129
106
  tilt (~> 1.1, != 1.3.0)
130
107
  thor (0.14.6)
131
- tilt (1.3.3)
108
+ tilt (1.4.1)
132
109
  treetop (1.4.12)
133
110
  polyglot
134
111
  polyglot (>= 0.3.1)
135
112
  tzinfo (0.3.35)
136
113
 
137
114
  PLATFORMS
138
- java
139
115
  ruby
140
116
 
141
117
  DEPENDENCIES
142
118
  appraisal
143
- growl
144
- guard
145
- guard-rspec
146
- rails
147
- rb-fsevent (>= 0.9.0.pre5)
119
+ rails (~> 3.0.0)
120
+ rake
148
121
  roadie!
122
+ rspec
149
123
  rspec-rails
@@ -1,6 +1,6 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source :rubygems
3
+ source "https://rubygems.org"
4
4
 
5
5
  gem "rails", "~> 3.1.0"
6
6
 
@@ -1,14 +1,14 @@
1
1
  PATH
2
- remote: /Users/mange/Projects/roadie
2
+ remote: /home/mange/Projects/roadie
3
3
  specs:
4
- roadie (2.3.3)
5
- actionmailer (> 3.0.0, < 3.3.0)
6
- css_parser
7
- nokogiri (>= 1.4.4)
4
+ roadie (2.3.4)
5
+ actionmailer (> 3.0.0, < 5.0.0)
6
+ css_parser (~> 1.3.4)
7
+ nokogiri (~> 1.6.0)
8
8
  sprockets
9
9
 
10
10
  GEM
11
- remote: http://rubygems.org/
11
+ remote: https://rubygems.org/
12
12
  specs:
13
13
  actionmailer (3.1.4)
14
14
  actionpack (= 3.1.4)
@@ -38,29 +38,28 @@ GEM
38
38
  activesupport (= 3.1.4)
39
39
  activesupport (3.1.4)
40
40
  multi_json (~> 1.0)
41
- addressable (2.3.2)
42
- appraisal (0.4.1)
41
+ addressable (2.3.5)
42
+ appraisal (0.5.1)
43
43
  bundler
44
44
  rake
45
45
  arel (2.2.3)
46
46
  builder (3.0.0)
47
- css_parser (1.2.6)
47
+ css_parser (1.3.4)
48
48
  addressable
49
- rdoc
50
49
  diff-lcs (1.1.3)
51
50
  erubis (2.7.0)
52
51
  hike (1.2.1)
53
- i18n (0.6.0)
54
- json (1.6.5)
55
- json (1.6.5-java)
52
+ i18n (0.6.1)
53
+ json (1.7.5)
56
54
  mail (2.3.3)
57
55
  i18n (>= 0.4.0)
58
56
  mime-types (~> 1.16)
59
57
  treetop (~> 1.4.8)
60
- mime-types (1.18)
61
- multi_json (1.1.0)
62
- nokogiri (1.5.5)
63
- nokogiri (1.5.5-java)
58
+ mime-types (1.19)
59
+ mini_portile (0.5.0)
60
+ multi_json (1.4.0)
61
+ nokogiri (1.6.0)
62
+ mini_portile (~> 0.5.0)
64
63
  polyglot (0.3.3)
65
64
  rack (1.3.6)
66
65
  rack-cache (1.2)
@@ -69,7 +68,7 @@ GEM
69
68
  rack (>= 1.0.0)
70
69
  rack-ssl (1.3.2)
71
70
  rack
72
- rack-test (0.6.1)
71
+ rack-test (0.6.2)
73
72
  rack (>= 1.0)
74
73
  rails (3.1.4)
75
74
  actionmailer (= 3.1.4)
@@ -86,39 +85,42 @@ GEM
86
85
  rake (>= 0.8.7)
87
86
  rdoc (~> 3.4)
88
87
  thor (~> 0.14.6)
89
- rake (0.9.2.2)
88
+ rake (10.0.2)
90
89
  rdoc (3.12)
91
90
  json (~> 1.4)
92
- rspec (2.9.0)
93
- rspec-core (~> 2.9.0)
94
- rspec-expectations (~> 2.9.0)
95
- rspec-mocks (~> 2.9.0)
96
- rspec-core (2.9.0)
97
- rspec-expectations (2.9.0)
91
+ rspec (2.12.0)
92
+ rspec-core (~> 2.12.0)
93
+ rspec-expectations (~> 2.12.0)
94
+ rspec-mocks (~> 2.12.0)
95
+ rspec-core (2.12.1)
96
+ rspec-expectations (2.12.0)
98
97
  diff-lcs (~> 1.1.3)
99
- rspec-mocks (2.9.0)
100
- rspec-rails (2.9.0)
98
+ rspec-mocks (2.12.0)
99
+ rspec-rails (2.12.0)
101
100
  actionpack (>= 3.0)
102
101
  activesupport (>= 3.0)
103
102
  railties (>= 3.0)
104
- rspec (~> 2.9.0)
103
+ rspec-core (~> 2.12.0)
104
+ rspec-expectations (~> 2.12.0)
105
+ rspec-mocks (~> 2.12.0)
105
106
  sprockets (2.0.3)
106
107
  hike (~> 1.2)
107
108
  rack (~> 1.0)
108
109
  tilt (~> 1.1, != 1.3.0)
109
110
  thor (0.14.6)
110
111
  tilt (1.3.3)
111
- treetop (1.4.10)
112
+ treetop (1.4.12)
112
113
  polyglot
113
114
  polyglot (>= 0.3.1)
114
- tzinfo (0.3.32)
115
+ tzinfo (0.3.35)
115
116
 
116
117
  PLATFORMS
117
- java
118
118
  ruby
119
119
 
120
120
  DEPENDENCIES
121
121
  appraisal
122
122
  rails (~> 3.1.0)
123
+ rake
123
124
  roadie!
125
+ rspec
124
126
  rspec-rails