premailer-rails 1.6.1 → 1.7.0

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: f2248a4e7484976c9aa3f9260873dc82927adb6d
4
- data.tar.gz: 0a3eb925b80da4498279e90e452931f87ac048d1
3
+ metadata.gz: 665414165c8702efcbef9842568949b076dfb340
4
+ data.tar.gz: d0db56e2bde48b63b36ef13a7734af8571cc24c1
5
5
  SHA512:
6
- metadata.gz: 3dadbfdf3c5e22ee924824bfc8ac398957723207fd46e1f245c92da341830514ba64f6b0fe34d0cdf602329960f83f1eaa6134631d639589e714b3230665c19b
7
- data.tar.gz: 9866e101c03db3be48bc0c840ec382875f7f7aee0042f9200712ac2eb28eb7665edde74d59df0c366dde132ef91bcbc108a2990ccaa6757c48f8474e6b2424d3
6
+ metadata.gz: 11a390432a6f4b4bdec544d5ef520a74021690a5bec1e937fc2940814b1bebfaae0d56c095d30e8f5baa76fcce080a233329c09d7c56be9e6123335bebb0ee7c
7
+ data.tar.gz: 708f338f00b204317d585d9fa632ed499bd7e97c473f0afdb007b36ab9ae7adba51cd4886f4f614da5fd285ffbc60be68c1e75f3d42490ef39c1207db1603b0e
@@ -2,6 +2,7 @@ language: ruby
2
2
  cache: bundler
3
3
  script: "bundle exec rspec"
4
4
  rvm:
5
+ - 2.1.0
5
6
  - 2.0.0
6
7
  - 1.9.3
7
8
  - ruby-head
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.7.0
4
+
5
+ - Register preview hook for the new previewing functionality introduced in
6
+ rails 4.1.0
7
+
8
+ - Add example rails application
9
+
10
+ ## v1.6.1
11
+
12
+ - Remove Nokogiri unicode fix since it's working properly without it by now
13
+
14
+ - Make sure html part comes before text part
15
+
3
16
  ## v1.6.0
4
17
 
5
18
  - Only use asset pipeline if Rails is defined and if compile is true
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.1
1
+ 1.7.0
@@ -0,0 +1,16 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+ /db/*.sqlite3-journal
13
+
14
+ # Ignore all logfiles and tempfiles.
15
+ /log/*.log
16
+ /tmp
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', github: 'rails'
4
+ gem 'sprockets-rails'
5
+
6
+ gem 'premailer-rails', path: '..'
7
+ gem 'nokogiri'
8
+
9
+ platforms :rbx do
10
+ gem 'rubysl'
11
+ gem 'racc'
12
+ end
@@ -0,0 +1,10 @@
1
+ # Example Rails App
2
+
3
+ To run this app, run:
4
+
5
+ ```shell
6
+ bundle
7
+ bundle exec rails s
8
+ ```
9
+
10
+ Then point your browser at [http://localhost:3000/](http://localhost:3000/).
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,32 @@
1
+ body {
2
+ background: #efefef;
3
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
4
+ }
5
+
6
+ p {
7
+ line-height: 1.4;
8
+ }
9
+
10
+ .wrap {
11
+ max-width: 40em;
12
+ margin: 0 auto;
13
+ padding: 1em;
14
+ background: white;
15
+ }
16
+
17
+ .greeting {
18
+ text-align: center;
19
+ font-weight: bold;
20
+ font-size: 110%;
21
+ }
22
+
23
+ .footer {
24
+ font-size: 90%;
25
+ color: #666;
26
+ }
27
+
28
+ a {
29
+ color: green;
30
+ text-decoration: none;
31
+ border-bottom: 2px solid green;
32
+ }
@@ -0,0 +1,7 @@
1
+ class ExampleMailer < ActionMailer::Base
2
+ default from: "from@example.com"
3
+
4
+ def test_message
5
+ mail to: 'to@example.org', subject: 'Test Message'
6
+ end
7
+ end
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset='utf-8'>
5
+ <%= stylesheet_link_tag :email %>
6
+ </head>
7
+ <body>
8
+ <div class='wrap'>
9
+ <p class='greeting'>Hi, John Doe</p>
10
+ <p>
11
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
12
+ </p>
13
+ <div class='footer'>
14
+ To unsubscribe, <a href='http://www.google.com/'>click here</a>.
15
+ </div>
16
+ </div>
17
+ </body>
18
+ </html>
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1,11 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'action_controller/railtie'
4
+ require 'action_mailer/railtie'
5
+
6
+ Bundler.require(*Rails.groups)
7
+
8
+ module Example
9
+ class Application < Rails::Application
10
+ end
11
+ end
@@ -0,0 +1,4 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,5 @@
1
+ Rails.application.configure do
2
+ config.cache_classes = false
3
+ config.eager_load = false
4
+ config.consider_all_requests_local = true
5
+ end
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ root to: redirect('rails/mailers/example_mailer/test_message')
3
+ end
@@ -0,0 +1,2 @@
1
+ development:
2
+ secret_key_base: bc1d05753b1a42a7d983dcb4f998c433532ec8f91ab3842a36ed3d9072d143a2d9c05a6dc43a3d780a2ff3d8e7b75a1011ae2e0d13a022e98dc1f0299da5a5a0
@@ -0,0 +1,5 @@
1
+ class ExampleMailerPreview < ActionMailer::Preview
2
+ def test_message
3
+ ExampleMailer.test_message
4
+ end
5
+ end
@@ -20,3 +20,7 @@ class Premailer
20
20
  end
21
21
 
22
22
  ActionMailer::Base.register_interceptor(Premailer::Rails::Hook)
23
+
24
+ if ActionMailer::Base.respond_to?(:register_preview_interceptor)
25
+ ActionMailer::Base.register_preview_interceptor(Premailer::Rails::Hook)
26
+ end
@@ -3,9 +3,14 @@ class Premailer
3
3
  class Hook
4
4
  attr_reader :message
5
5
 
6
- def self.delivering_email(message)
7
- self.new(message).perform
8
- message
6
+ class << self
7
+ def perform(message)
8
+ new(message).perform
9
+ message
10
+ end
11
+
12
+ alias_method :delivering_email, :perform
13
+ alias_method :previewing_email, :perform
9
14
  end
10
15
 
11
16
  def initialize(message)
@@ -1,9 +1,15 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'ActionMailer::Base.register_interceptor' do
4
- it 'should register interceptor Premailer::Rails::Hook' do
4
+ it 'registers interceptor' do
5
5
  expect(ActionMailer::Base).to \
6
6
  receive(:register_interceptor).with(Premailer::Rails::Hook)
7
7
  load 'premailer/rails.rb'
8
8
  end
9
+
10
+ it 'registers preview interceptor' do
11
+ expect(ActionMailer::Base).to \
12
+ receive(:register_preview_interceptor).with(Premailer::Rails::Hook)
13
+ load 'premailer/rails.rb'
14
+ end
9
15
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Premailer::Rails::Hook do
4
4
  def run_hook(message)
5
- Premailer::Rails::Hook.delivering_email(message)
5
+ Premailer::Rails::Hook.perform(message)
6
6
  end
7
7
 
8
8
  class Mail::Message
@@ -14,6 +14,24 @@ describe Premailer::Rails::Hook do
14
14
  let(:message) { Fixtures::Message.with_parts(:html) }
15
15
  let(:processed_message) { run_hook(message) }
16
16
 
17
+ describe '.delivering_email' do
18
+ it 'is an alias to .perform' do
19
+ method = described_class.method(:delivering_email)
20
+ expected_method = described_class.method(:perform)
21
+
22
+ expect(method).to eq expected_method
23
+ end
24
+ end
25
+
26
+ describe '.previewing_email' do
27
+ it 'is an alias to .perform' do
28
+ method = described_class.method(:previewing_email)
29
+ expected_method = described_class.method(:perform)
30
+
31
+ expect(method).to eq expected_method
32
+ end
33
+ end
34
+
17
35
  it 'inlines the CSS' do
18
36
  expect { run_hook(message) }.to \
19
37
  change { message.html_string.include?("<p style=") }
metadata CHANGED
@@ -1,109 +1,109 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: premailer-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philipe Fatio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-18 00:00:00.000000000 Z
11
+ date: 2014-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: premailer
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.7'
20
- - - '>='
20
+ - - ">="
21
21
  - !ruby/object:Gem::Version
22
22
  version: 1.7.9
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - ~>
27
+ - - "~>"
28
28
  - !ruby/object:Gem::Version
29
29
  version: '1.7'
30
- - - '>='
30
+ - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 1.7.9
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: actionmailer
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - '>='
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '3'
40
- - - <
40
+ - - "<"
41
41
  - !ruby/object:Gem::Version
42
42
  version: '5'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '3'
50
- - - <
50
+ - - "<"
51
51
  - !ruby/object:Gem::Version
52
52
  version: '5'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: rspec
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - '>='
57
+ - - ">="
58
58
  - !ruby/object:Gem::Version
59
59
  version: 3.0.0.beta1
60
60
  type: :development
61
61
  prerelease: false
62
62
  version_requirements: !ruby/object:Gem::Requirement
63
63
  requirements:
64
- - - '>='
64
+ - - ">="
65
65
  - !ruby/object:Gem::Version
66
66
  version: 3.0.0.beta1
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: nokogiri
69
69
  requirement: !ruby/object:Gem::Requirement
70
70
  requirements:
71
- - - '>='
71
+ - - ">="
72
72
  - !ruby/object:Gem::Version
73
73
  version: '0'
74
74
  type: :development
75
75
  prerelease: false
76
76
  version_requirements: !ruby/object:Gem::Requirement
77
77
  requirements:
78
- - - '>='
78
+ - - ">="
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: hpricot
83
83
  requirement: !ruby/object:Gem::Requirement
84
84
  requirements:
85
- - - '>='
85
+ - - ">="
86
86
  - !ruby/object:Gem::Version
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
90
  version_requirements: !ruby/object:Gem::Requirement
91
91
  requirements:
92
- - - '>='
92
+ - - ">="
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  - !ruby/object:Gem::Dependency
96
96
  name: coveralls
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - '>='
99
+ - - ">="
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  type: :development
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
- - - '>='
106
+ - - ">="
107
107
  - !ruby/object:Gem::Version
108
108
  version: '0'
109
109
  description: |-
@@ -117,16 +117,31 @@ executables: []
117
117
  extensions: []
118
118
  extra_rdoc_files: []
119
119
  files:
120
- - .coveralls.yml
121
- - .gitignore
122
- - .rspec
123
- - .travis.yml
120
+ - ".coveralls.yml"
121
+ - ".gitignore"
122
+ - ".rspec"
123
+ - ".travis.yml"
124
124
  - CHANGELOG.md
125
125
  - Gemfile
126
126
  - LICENSE
127
127
  - README.md
128
128
  - Rakefile
129
129
  - VERSION
130
+ - example/.gitignore
131
+ - example/Gemfile
132
+ - example/README.md
133
+ - example/Rakefile
134
+ - example/app/assets/stylesheets/email.css
135
+ - example/app/mailers/example_mailer.rb
136
+ - example/app/views/example_mailer/test_message.html.erb
137
+ - example/config.ru
138
+ - example/config/application.rb
139
+ - example/config/boot.rb
140
+ - example/config/environment.rb
141
+ - example/config/environments/development.rb
142
+ - example/config/routes.rb
143
+ - example/config/secrets.yml
144
+ - example/test/mailers/previews/example_mailer_preview.rb
130
145
  - lib/premailer/rails.rb
131
146
  - lib/premailer/rails/css_helper.rb
132
147
  - lib/premailer/rails/css_loaders.rb
@@ -158,17 +173,17 @@ require_paths:
158
173
  - lib
159
174
  required_ruby_version: !ruby/object:Gem::Requirement
160
175
  requirements:
161
- - - '>='
176
+ - - ">="
162
177
  - !ruby/object:Gem::Version
163
178
  version: '0'
164
179
  required_rubygems_version: !ruby/object:Gem::Requirement
165
180
  requirements:
166
- - - '>='
181
+ - - ">="
167
182
  - !ruby/object:Gem::Version
168
183
  version: '0'
169
184
  requirements: []
170
185
  rubyforge_project:
171
- rubygems_version: 2.1.11
186
+ rubygems_version: 2.2.0
172
187
  signing_key:
173
188
  specification_version: 4
174
189
  summary: Easily create styled HTML emails in Rails.