premailer-rails 1.8.0 → 1.8.1

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: 1acf912800a7228a1dcf6b89f5412ee87490f975
4
- data.tar.gz: 2ab5e6bf63b3d7a0fa974b5495df7919eaeb9d10
3
+ metadata.gz: 7d3ecd8b9d9f55c3039cad6467d7de1fc2676565
4
+ data.tar.gz: 985538b2930d3bae69fe75b9415af3f4d4f411eb
5
5
  SHA512:
6
- metadata.gz: feef5aa13b18d39709bf2f9fd931eecff8876a11bf3500199f91c2ba06e15853d60787984425371b51ef4fbc60c555a7b8df38ab0e108e4c4766e4e624fba52b
7
- data.tar.gz: dc7c3b13551d5445c58998154a342d79f2b4e0d56fd4b909d1264df3d0511e958d03bbd475f98a387c3c8bdec23fcead519c7a60ac150dff7955f78da46bb884
6
+ metadata.gz: 4e13cd460126fb67c58f89d186157463ca47162a228cc12e46dfc373bd9773d30a11ba318c9ea36d1892474b94bf3a2008c49e847ed35b049acf095f6da517d0
7
+ data.tar.gz: c0cdc0051dd65ef19bffb36378943733c4f66f68c3ef8662f77a66763a4439f8024daf20b1a35f5d11285bb730bc8ef256eed8ea8460fee387fa2fdda8f9a39b
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.8.1
4
+
5
+ - Add support for longer fingerprint generated by sprocket 3.
6
+
3
7
  ## v1.8.0
4
8
 
5
9
  - `ActionMailer` interceptors are registered after Rails initialization and no
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # premailer-rails
1
+ ki premailer-rails
2
2
 
3
3
  CSS styled emails without the hassle.
4
4
 
@@ -137,6 +137,11 @@ class UserMailer < ActionMailer::Base
137
137
  end
138
138
  ```
139
139
 
140
+ Note that the mere presence of this header causes premailer to be skipped, i.e.,
141
+ even setting `skip_premailer: false` will cause premailer to be skipped. The
142
+ reason for that is that the `skip_premailer` is a simple header and the value is
143
+ transformed into a string, causing `'false'` to become truethy.
144
+
140
145
  ## Small Print
141
146
 
142
147
  ### Author
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.8.0
1
+ 1.8.1
@@ -6,7 +6,6 @@ require 'premailer/rails/css_loaders'
6
6
  require 'premailer/rails/css_helper'
7
7
  require 'premailer/rails/customized_premailer'
8
8
  require 'premailer/rails/hook'
9
- require 'premailer/rails/railtie' if defined?(Rails)
10
9
 
11
10
  class Premailer
12
11
  module Rails
@@ -27,3 +26,5 @@ class Premailer
27
26
  end
28
27
  end
29
28
  end
29
+
30
+ require 'premailer/rails/railtie' if defined?(Rails)
@@ -19,7 +19,7 @@ class Premailer
19
19
  def file_name(url)
20
20
  URI(url).path
21
21
  .sub("#{::Rails.configuration.assets.prefix}/", '')
22
- .sub(/-\h{32}\.css$/, '.css')
22
+ .sub(/-(\h{32}|\h{64})\.css$/, '.css')
23
23
  end
24
24
  end
25
25
  end
@@ -14,7 +14,7 @@ class Premailer
14
14
 
15
15
  if not valid_uri?(uri) and defined?(::Rails)
16
16
  scheme, host =
17
- ::Rails.configuration.action_controller.asset_host.split(%r{:?//})
17
+ asset_host.split(%r{:?//})
18
18
  scheme = 'http' if scheme.blank?
19
19
  uri.scheme ||= scheme
20
20
  uri.host ||= host
@@ -26,6 +26,16 @@ class Premailer
26
26
  def valid_uri?(uri)
27
27
  uri.host.present? && uri.scheme.present?
28
28
  end
29
+
30
+ def asset_host
31
+ host = ::Rails.configuration.action_controller.asset_host
32
+
33
+ if host.respond_to?(:call)
34
+ host.call
35
+ else
36
+ host
37
+ end
38
+ end
29
39
  end
30
40
  end
31
41
  end
@@ -42,7 +42,7 @@ class Premailer
42
42
  # Returns true if the message itself has a content type of text/html, thus
43
43
  # it does not contain other parts such as alternatives and attachments.
44
44
  def pure_html_message?
45
- message.content_type.include?('text/html')
45
+ message.content_type && message.content_type.include?('text/html')
46
46
  end
47
47
 
48
48
  def generate_html_part_replacement
@@ -17,11 +17,16 @@ describe Premailer::Rails::CSSLoaders::AssetPipelineLoader do
17
17
  it { is_expected.to eq('application.css') }
18
18
  end
19
19
 
20
- context "when asset file path contains fingerprint" do
20
+ context "when asset file path contains 32 chars fingerprint" do
21
21
  let(:asset) { 'application-6776f581a4329e299531e1d52aa59832.css' }
22
22
  it { is_expected.to eq('application.css') }
23
23
  end
24
24
 
25
+ context "when asset file path contains 64 chars fingerprint" do
26
+ let(:asset) { 'application-02275ccb3fd0c11615bbfb11c99ea123ca2287e75045fe7b72cefafb880dad2b.css' }
27
+ it { is_expected.to eq('application.css') }
28
+ end
29
+
25
30
  context "when asset file page contains numbers, but not a fingerprint" do
26
31
  let(:asset) { 'test/20130708152545-foo-bar.css' }
27
32
  it { is_expected.to eq("test/20130708152545-foo-bar.css") }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: premailer-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philipe Fatio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-31 00:00:00.000000000 Z
11
+ date: 2015-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: premailer
@@ -184,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
184
  version: '0'
185
185
  requirements: []
186
186
  rubyforge_project:
187
- rubygems_version: 2.2.2
187
+ rubygems_version: 2.4.5
188
188
  signing_key:
189
189
  specification_version: 4
190
190
  summary: Easily create styled HTML emails in Rails.