premailer-rails 1.9.6 → 1.9.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/VERSION +1 -1
- data/lib/premailer/rails/css_loaders/file_system_loader.rb +9 -1
- data/spec/unit/css_loaders/file_system_loader_spec.rb +5 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34449fbe39f5a20061a3f6b389a95c4286b6a2cc
|
4
|
+
data.tar.gz: 551a7262f0926f02554a6bea9c47eb4446d04d82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 507c28b394a9ec1fdf24e6a51b45f0cad7ac6b7ad3012f7c5993db164eeb1f100d9a410a10d4d5876f68cf9e8f9a3a2febf8a5cad5cc116823abaa84714ba8e7
|
7
|
+
data.tar.gz: f3fb70d57c1acf9e196dadc98c53061ed45b2604c9a721e8eff194dd9e42b45243c5c07b4bcaa6b555ae97e5d163ba27c65cb6dcbfab61ed9b4f2168f813f853
|
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.9.
|
1
|
+
1.9.7
|
@@ -14,7 +14,15 @@ class Premailer
|
|
14
14
|
if relative_url_root
|
15
15
|
path = path.sub(/\A#{relative_url_root.chomp('/')}/, '')
|
16
16
|
end
|
17
|
-
|
17
|
+
asset_filename(path)
|
18
|
+
end
|
19
|
+
|
20
|
+
def asset_filename(filename)
|
21
|
+
if defined?(::Rails) && ::Rails.respond_to?(:root)
|
22
|
+
File.join(::Rails.root, 'public', filename)
|
23
|
+
else
|
24
|
+
File.join('public', filename)
|
25
|
+
end
|
18
26
|
end
|
19
27
|
|
20
28
|
def relative_url_root
|
@@ -4,6 +4,8 @@ describe Premailer::Rails::CSSLoaders::FileSystemLoader do
|
|
4
4
|
before do
|
5
5
|
allow(Rails.configuration)
|
6
6
|
.to receive(:assets).and_return(double(prefix: '/assets'))
|
7
|
+
allow(Rails)
|
8
|
+
.to receive(:root).and_return(Pathname.new('/rails_root'))
|
7
9
|
end
|
8
10
|
|
9
11
|
describe '#file_name' do
|
@@ -17,19 +19,19 @@ describe Premailer::Rails::CSSLoaders::FileSystemLoader do
|
|
17
19
|
|
18
20
|
context 'when relative_url_root is not set' do
|
19
21
|
let(:asset) { '/assets/application.css' }
|
20
|
-
it { is_expected.to eq('public/assets/application.css') }
|
22
|
+
it { is_expected.to eq(File.join(Rails.root, 'public/assets/application.css')) }
|
21
23
|
end
|
22
24
|
|
23
25
|
context 'when relative_url_root is set' do
|
24
26
|
let(:relative_url_root) { '/foo' }
|
25
27
|
let(:asset) { '/foo/assets/application.css' }
|
26
|
-
it { is_expected.to eq('public/assets/application.css') }
|
28
|
+
it { is_expected.to eq(File.join(Rails.root, 'public/assets/application.css')) }
|
27
29
|
end
|
28
30
|
|
29
31
|
context 'when relative_url_root has a trailing slash' do
|
30
32
|
let(:relative_url_root) { '/foo/' }
|
31
33
|
let(:asset) { '/foo/assets/application.css' }
|
32
|
-
it { is_expected.to eq('public/assets/application.css') }
|
34
|
+
it { is_expected.to eq(File.join(Rails.root, 'public/assets/application.css')) }
|
33
35
|
end
|
34
36
|
end
|
35
37
|
end
|
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.9.
|
4
|
+
version: 1.9.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philipe Fatio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: premailer
|