premailer-rails 1.9.5 → 1.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -9
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -1
- data/README.md +2 -1
- data/VERSION +1 -1
- data/lib/premailer/rails/css_loaders/file_system_loader.rb +16 -2
- data/spec/spec_helper.rb +4 -0
- data/spec/unit/css_loaders/file_system_loader_spec.rb +35 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 921889a0d16fba418ad624860751a2859349477e
|
4
|
+
data.tar.gz: 6766aae6456138af9b603c99b6792261081ed02c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee8d13c60df7937a75c413cc54263ba36b101f15cead9b8c3b1881f3e208b9cf16a6a1781d47492c2afa69360d79674a431e2273777d3d0abc322745637645c3
|
7
|
+
data.tar.gz: 32aa76f207b989cf6799e01d2a8de70e1044a4d61b3d23d85f7adaba7b82d03343bd2d686b043b65f0bc9535905817d2ff250de00bae5d616313e9342d5ff6de
|
data/.travis.yml
CHANGED
@@ -3,20 +3,13 @@ language: ruby
|
|
3
3
|
cache: bundler
|
4
4
|
script: bundle exec rspec
|
5
5
|
rvm:
|
6
|
-
- 2.
|
7
|
-
- ruby-head
|
8
|
-
- jruby
|
9
|
-
- rbx-2
|
6
|
+
- 2.4.1
|
10
7
|
env:
|
11
|
-
global:
|
12
|
-
- JRUBY_OPTS="--2.0"
|
13
8
|
matrix:
|
14
9
|
- ACTION_MAILER_VERSION=4
|
15
|
-
- ACTION_MAILER_VERSION=5
|
10
|
+
- ACTION_MAILER_VERSION=5
|
16
11
|
- ACTION_MAILER_VERSION=master
|
17
12
|
matrix:
|
18
13
|
fast_finish: true
|
19
14
|
allow_failures:
|
20
15
|
- env: ACTION_MAILER_VERSION=master
|
21
|
-
- env: ACTION_MAILER_VERSION=5.beta
|
22
|
-
- rvm: ruby-head
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.9.
|
1
|
+
1.9.6
|
@@ -5,9 +5,23 @@ class Premailer
|
|
5
5
|
extend self
|
6
6
|
|
7
7
|
def load(url)
|
8
|
+
file = file_name(url)
|
9
|
+
File.read(file) if File.file?(file)
|
10
|
+
end
|
11
|
+
|
12
|
+
def file_name(url)
|
8
13
|
path = URI(url).path
|
9
|
-
|
10
|
-
|
14
|
+
if relative_url_root
|
15
|
+
path = path.sub(/\A#{relative_url_root.chomp('/')}/, '')
|
16
|
+
end
|
17
|
+
"public#{path}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def relative_url_root
|
21
|
+
defined?(::Rails) &&
|
22
|
+
::Rails.respond_to?(:configuration) &&
|
23
|
+
::Rails.configuration.respond_to?(:relative_url_root) &&
|
24
|
+
::Rails.configuration.relative_url_root
|
11
25
|
end
|
12
26
|
end
|
13
27
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Premailer::Rails::CSSLoaders::FileSystemLoader do
|
4
|
+
before do
|
5
|
+
allow(Rails.configuration)
|
6
|
+
.to receive(:assets).and_return(double(prefix: '/assets'))
|
7
|
+
end
|
8
|
+
|
9
|
+
describe '#file_name' do
|
10
|
+
subject { described_class.file_name(asset) }
|
11
|
+
let(:relative_url_root) { nil }
|
12
|
+
|
13
|
+
before do
|
14
|
+
config = double(relative_url_root: relative_url_root)
|
15
|
+
allow(Rails).to receive(:configuration).and_return(config)
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'when relative_url_root is not set' do
|
19
|
+
let(:asset) { '/assets/application.css' }
|
20
|
+
it { is_expected.to eq('public/assets/application.css') }
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'when relative_url_root is set' do
|
24
|
+
let(:relative_url_root) { '/foo' }
|
25
|
+
let(:asset) { '/foo/assets/application.css' }
|
26
|
+
it { is_expected.to eq('public/assets/application.css') }
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'when relative_url_root has a trailing slash' do
|
30
|
+
let(:relative_url_root) { '/foo/' }
|
31
|
+
let(:asset) { '/foo/assets/application.css' }
|
32
|
+
it { is_expected.to eq('public/assets/application.css') }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philipe Fatio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: premailer
|
@@ -166,6 +166,7 @@ files:
|
|
166
166
|
- spec/support/stubs/action_mailer.rb
|
167
167
|
- spec/support/stubs/rails.rb
|
168
168
|
- spec/unit/css_loaders/asset_pipeline_loader_spec.rb
|
169
|
+
- spec/unit/css_loaders/file_system_loader_spec.rb
|
169
170
|
- spec/unit/css_loaders/network_loader_spec.rb
|
170
171
|
- spec/unit/customized_premailer_spec.rb
|
171
172
|
- spec/unit/premailer_rails_spec.rb
|
@@ -189,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
190
|
version: '0'
|
190
191
|
requirements: []
|
191
192
|
rubyforge_project:
|
192
|
-
rubygems_version: 2.
|
193
|
+
rubygems_version: 2.6.11
|
193
194
|
signing_key:
|
194
195
|
specification_version: 4
|
195
196
|
summary: Easily create styled HTML emails in Rails.
|
@@ -220,7 +221,7 @@ test_files:
|
|
220
221
|
- spec/support/stubs/action_mailer.rb
|
221
222
|
- spec/support/stubs/rails.rb
|
222
223
|
- spec/unit/css_loaders/asset_pipeline_loader_spec.rb
|
224
|
+
- spec/unit/css_loaders/file_system_loader_spec.rb
|
223
225
|
- spec/unit/css_loaders/network_loader_spec.rb
|
224
226
|
- spec/unit/customized_premailer_spec.rb
|
225
227
|
- spec/unit/premailer_rails_spec.rb
|
226
|
-
has_rdoc:
|