premailer-rails 1.11.1 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +64 -0
  3. data/CHANGELOG.md +6 -0
  4. data/Gemfile +13 -13
  5. data/README.md +11 -9
  6. data/VERSION +1 -1
  7. data/{example → examples/rails5}/.gitignore +0 -0
  8. data/examples/rails5/Gemfile +4 -0
  9. data/{example → examples/rails5}/README.md +0 -0
  10. data/{example → examples/rails5}/Rakefile +1 -1
  11. data/{example → examples/rails5}/app/assets/stylesheets/email.css +0 -0
  12. data/{example → examples/rails5}/app/mailers/example_mailer.rb +0 -0
  13. data/{example → examples/rails5}/app/views/example_mailer/test_message.html.erb +0 -0
  14. data/{example → examples/rails5}/bin/rails +1 -1
  15. data/{example → examples/rails5}/config/application.rb +4 -1
  16. data/examples/rails5/config/boot.rb +3 -0
  17. data/{example → examples/rails5}/config/environment.rb +1 -1
  18. data/{example → examples/rails5}/config/environments/development.rb +0 -0
  19. data/{example → examples/rails5}/config/environments/production.rb +0 -0
  20. data/{example → examples/rails5}/config/initializers/assets.rb +0 -0
  21. data/{example → examples/rails5}/config/routes.rb +0 -0
  22. data/{example → examples/rails5}/config.ru +2 -1
  23. data/{example → examples/rails5}/test/mailers/previews/example_mailer_preview.rb +0 -0
  24. data/examples/rails6/.gitignore +16 -0
  25. data/examples/rails6/Gemfile +5 -0
  26. data/examples/rails6/README.md +10 -0
  27. data/examples/rails6/Rakefile +6 -0
  28. data/examples/rails6/app/assets/config/manifest.js +1 -0
  29. data/examples/rails6/app/assets/stylesheets/email.css +32 -0
  30. data/examples/rails6/app/mailers/example_mailer.rb +7 -0
  31. data/examples/rails6/app/views/example_mailer/test_message.html.erb +18 -0
  32. data/examples/rails6/bin/rails +4 -0
  33. data/examples/rails6/config/application.rb +15 -0
  34. data/examples/rails6/config/boot.rb +3 -0
  35. data/examples/rails6/config/environment.rb +5 -0
  36. data/examples/rails6/config/environments/development.rb +9 -0
  37. data/examples/rails6/config/environments/production.rb +9 -0
  38. data/examples/rails6/config/routes.rb +3 -0
  39. data/examples/rails6/config.ru +6 -0
  40. data/examples/rails6/test/mailers/previews/example_mailer_preview.rb +5 -0
  41. data/examples/rails7-propshaft/.gitignore +16 -0
  42. data/examples/rails7-propshaft/Gemfile +6 -0
  43. data/examples/rails7-propshaft/README.md +10 -0
  44. data/examples/rails7-propshaft/Rakefile +6 -0
  45. data/examples/rails7-propshaft/app/assets/stylesheets/email.css +32 -0
  46. data/examples/rails7-propshaft/app/mailers/example_mailer.rb +7 -0
  47. data/examples/rails7-propshaft/app/views/example_mailer/test_message.html.erb +18 -0
  48. data/examples/rails7-propshaft/bin/rails +4 -0
  49. data/examples/rails7-propshaft/config/application.rb +14 -0
  50. data/examples/rails7-propshaft/config/boot.rb +3 -0
  51. data/examples/rails7-propshaft/config/environment.rb +5 -0
  52. data/examples/rails7-propshaft/config/environments/development.rb +9 -0
  53. data/examples/rails7-propshaft/config/environments/production.rb +9 -0
  54. data/examples/rails7-propshaft/config/routes.rb +3 -0
  55. data/examples/rails7-propshaft/config.ru +6 -0
  56. data/examples/rails7-propshaft/test/mailers/previews/example_mailer_preview.rb +5 -0
  57. data/examples/rails7-sprockets/.gitignore +16 -0
  58. data/examples/rails7-sprockets/Gemfile +6 -0
  59. data/examples/rails7-sprockets/README.md +10 -0
  60. data/examples/rails7-sprockets/Rakefile +6 -0
  61. data/examples/rails7-sprockets/app/assets/config/manifest.js +1 -0
  62. data/examples/rails7-sprockets/app/assets/stylesheets/email.css +32 -0
  63. data/examples/rails7-sprockets/app/mailers/example_mailer.rb +7 -0
  64. data/examples/rails7-sprockets/app/views/example_mailer/test_message.html.erb +18 -0
  65. data/examples/rails7-sprockets/bin/rails +4 -0
  66. data/examples/rails7-sprockets/config/application.rb +14 -0
  67. data/examples/rails7-sprockets/config/boot.rb +3 -0
  68. data/examples/rails7-sprockets/config/environment.rb +5 -0
  69. data/examples/rails7-sprockets/config/environments/development.rb +9 -0
  70. data/examples/rails7-sprockets/config/environments/production.rb +9 -0
  71. data/examples/rails7-sprockets/config/routes.rb +3 -0
  72. data/examples/rails7-sprockets/config.ru +6 -0
  73. data/examples/rails7-sprockets/test/mailers/previews/example_mailer_preview.rb +5 -0
  74. data/lib/premailer/rails/css_helper.rb +2 -0
  75. data/lib/premailer/rails/css_loaders/asset_pipeline_loader.rb +4 -4
  76. data/lib/premailer/rails/css_loaders/network_loader.rb +1 -1
  77. data/lib/premailer/rails/css_loaders/propshaft_loader.rb +38 -0
  78. data/lib/premailer/rails/css_loaders.rb +1 -0
  79. data/lib/premailer/rails/railtie.rb +1 -1
  80. data/lib/premailer/rails.rb +1 -1
  81. data/premailer-rails.gemspec +3 -1
  82. data/spec/integration/css_helper_spec.rb +173 -71
  83. data/spec/rails_app/config/application.rb +7 -1
  84. data/spec/spec_helper.rb +0 -13
  85. data/spec/unit/css_loaders/asset_pipeline_loader_spec.rb +44 -32
  86. data/spec/unit/css_loaders/propshaft_loader_spec.rb +57 -0
  87. metadata +91 -56
  88. data/.coveralls.yml +0 -1
  89. data/.travis.yml +0 -16
  90. data/example/Gemfile +0 -10
  91. data/example/config/boot.rb +0 -3
  92. data/example/config/secrets.yml +0 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 13055f85c556422022c71564c81f5816ecffd482e4514c1481212fab2c942eb7
4
- data.tar.gz: 8b9093f66f195ac826382329877be7c9b863650c5bcb0c057bae0cc073b8978d
3
+ metadata.gz: d1ade699bd19b081f52953b727ac7d58019325a8724ebcb49f95158eb832b10d
4
+ data.tar.gz: 380a46fefaa3d09f491975b45d47590af610d72965ce7c6190b94aeb78a57a6d
5
5
  SHA512:
6
- metadata.gz: a861465e80d026c7e221b09f0c395be4d4fb26fa3662a233de5ba8295c41f0861b79958f873830fa4bd6333bd21798298155f8cadf1cf7861f08f5348ee3f901
7
- data.tar.gz: f4cd1b29b3b1a4ee43fe83971b35b6a43896298ab3c1fec8d4fc91e2fc0d1290b353bba0096e2ae45376e394f6ad00142cf3dda7447a72259c7639c01fbd4231
6
+ metadata.gz: 374b301926c5084c16ee45c169715d5d53f413f398791e4c20ec3b50b52d8f065dbda20fb55c702bee153051c6480432577c1f5f33f0fe94d431a42bd07b7b7b
7
+ data.tar.gz: 2567fb6f0ab9323a6f05e292349b7a9e03d65991a5477c0584baa488dd01247469bf123e96669721f0e6326b1b3cb6b3f571dc0a6da8a428a92845d832241d51
@@ -0,0 +1,64 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - "*"
7
+ pull_request:
8
+ branches:
9
+ - "*"
10
+ # Enable triggering CI runs manually.
11
+ workflow_dispatch:
12
+
13
+ concurrency:
14
+ group: ${{ github.workflow }}-${{ github.ref }}
15
+ cancel-in-progress: true
16
+
17
+ jobs:
18
+ test:
19
+ runs-on: ubuntu-latest
20
+ continue-on-error: ${{ matrix.experimental }}
21
+ strategy:
22
+ fail-fast: false
23
+ matrix:
24
+ ruby:
25
+ - '2.7'
26
+ - '3.1'
27
+ action_mailer_version:
28
+ - 5
29
+ - 6
30
+ - 7
31
+ propshaft:
32
+ - false
33
+ - true
34
+ experimental:
35
+ - false
36
+ exclude:
37
+ - ruby: '3.1'
38
+ action_mailer_version: 5
39
+ - action_mailer_version: 5
40
+ propshaft: true
41
+ - action_mailer_version: 6
42
+ propshaft: true
43
+ include:
44
+ - ruby: head
45
+ action_mailer_version: head
46
+ propshaft: false
47
+ experimental: true
48
+ - ruby: head
49
+ action_mailer_version: head
50
+ propshaft: true
51
+ experimental: true
52
+ steps:
53
+ - uses: actions/checkout@v3
54
+
55
+ - name: Set env vars
56
+ run: |
57
+ echo "ACTION_MAILER_VERSION=${{ matrix.action_mailer_version }}" >> $GITHUB_ENV
58
+ echo "PROPSHAFT=${{ matrix.propshaft }}" >> $GITHUB_ENV
59
+
60
+ - uses: ruby/setup-ruby@v1
61
+ with:
62
+ ruby-version: ${{ matrix.ruby }}
63
+ bundler-cache: true
64
+ - run: bundle exec rake
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.12.0
4
+
5
+ - Lazily load actionmailer (@c960657, #260)
6
+ - HTTP request for CSS files now have an `Accept: text/css` header (@ElMassimo, #261)
7
+ - Added support for [Propshaft](https://github.com/rails/propshaft) (@Intrepidd, #277)
8
+
3
9
  ## v1.11.1
4
10
 
5
11
  - Check if `Rails.application` is defined (@pabloh, #250)
data/Gemfile CHANGED
@@ -1,24 +1,24 @@
1
1
  source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
2
3
 
3
4
  gemspec
4
5
 
5
- rails_version = ENV.fetch('ACTION_MAILER_VERSION', '5')
6
+ rails_version = ENV.fetch('ACTION_MAILER_VERSION', '7')
6
7
 
7
- if rails_version == 'master'
8
- git 'git://github.com/rails/rails.git' do
9
- gem 'rails'
8
+ if rails_version == 'head'
9
+ gem 'rails', github: 'rails/rails'
10
+ if ENV['PROPSHAFT'] == 'true'
11
+ gem 'propshaft', github: 'rails/propshaft'
12
+ else
13
+ gem 'sprockets-rails', github: 'rails/sprockets-rails'
10
14
  end
11
- gem 'sprockets-rails', github: 'rails/sprockets-rails'
12
- gem 'arel', github: 'rails/arel'
13
15
  else
14
16
  gem 'rails', "~> #{rails_version}"
17
+ if ENV['PROPSHAFT'] == 'true'
18
+ gem 'propshaft'
19
+ else
20
+ gem 'sprockets-rails' if rails_version >= '7'
21
+ end
15
22
  end
16
23
 
17
24
  gem 'byebug'
18
-
19
- platforms :rbx do
20
- gem 'rubysl'
21
- gem 'racc'
22
- end
23
-
24
- gem 'tins', '< 1.7' if RUBY_VERSION.split('.').first.to_i < 2
data/README.md CHANGED
@@ -4,9 +4,7 @@ CSS styled emails without the hassle.
4
4
 
5
5
  [![Build Status][build-image]][build-link]
6
6
  [![Gem Version][gem-image]][gem-link]
7
- [![Dependency Status][deps-image]][deps-link]
8
7
  [![Code Climate][gpa-image]][gpa-link]
9
- [![Coverage Status][cov-image]][cov-link]
10
8
 
11
9
  ## Introduction
12
10
 
@@ -152,6 +150,14 @@ Premailer::Rails::Hook.perform(mail)
152
150
 
153
151
  This will modify the email in place, useful e.g. in tests.
154
152
 
153
+ ## Supported Rails Versions
154
+
155
+ This gem is tested on Rails versions 5 through 7.
156
+
157
+ For Rails 7, it support both the classical Sprockets asset pipeline as well as the new [Propshaft](https://github.com/rails/propshaft) gem.
158
+
159
+ If you're looking to integrate with Webpacker, check out [these instructions](https://github.com/fphilipe/premailer-rails/issues/232#issuecomment-839819705).
160
+
155
161
  ## Small Print
156
162
 
157
163
  ### Author
@@ -162,21 +168,17 @@ Philipe Fatio ([@fphilipe][fphilipe twitter])
162
168
 
163
169
  premailer-rails is released under the MIT license. See the [license file].
164
170
 
165
- [build-image]: https://travis-ci.org/fphilipe/premailer-rails.svg
166
- [build-link]: https://travis-ci.org/fphilipe/premailer-rails
171
+ [build-image]: https://github.com/fphilipe/premailer-rails/actions/workflows/test.yml/badge.svg
172
+ [build-link]: https://github.com/fphilipe/premailer-rails/actions/workflows/test.yml
167
173
  [gem-image]: https://badge.fury.io/rb/premailer-rails.svg
168
174
  [gem-link]: https://rubygems.org/gems/premailer-rails
169
- [deps-image]: https://gemnasium.com/fphilipe/premailer-rails.svg
170
- [deps-link]: https://gemnasium.com/fphilipe/premailer-rails
171
175
  [gpa-image]: https://codeclimate.com/github/fphilipe/premailer-rails.svg
172
176
  [gpa-link]: https://codeclimate.com/github/fphilipe/premailer-rails
173
- [cov-image]: https://coveralls.io/repos/fphilipe/premailer-rails/badge.svg
174
- [cov-link]: https://coveralls.io/r/fphilipe/premailer-rails
175
177
  [tip-image]: https://rawgithub.com/twolfson/gittip-badge/0.1.0/dist/gittip.svg
176
178
  [tip-link]: https://www.gittip.com/fphilipe/
177
179
 
178
180
  [premailer]: https://github.com/premailer/premailer
179
- [actionmailer]: https://github.com/rails/rails/tree/master/actionmailer
181
+ [actionmailer]: https://github.com/rails/rails/tree/main/actionmailer
180
182
  [nokogiri]: https://github.com/sparklemotion/nokogiri
181
183
 
182
184
  [premailer documentation]: https://www.rubydoc.info/gems/premailer/Premailer:initialize
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.11.1
1
+ 1.12.0
File without changes
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', '~> 5.2', '>= 5.2.8.1'
4
+ gem 'premailer-rails', path: '../..'
File without changes
@@ -1,6 +1,6 @@
1
1
  # Add your own tasks in files placed in lib/tasks ending in .rake,
2
2
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
3
 
4
- require File.expand_path('../config/application', __FILE__)
4
+ require_relative 'config/application'
5
5
 
6
6
  Rails.application.load_tasks
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
2
+ APP_PATH = File.expand_path('../config/application', __dir__)
3
3
  require_relative '../config/boot'
4
4
  require 'rails/commands'
@@ -1,12 +1,15 @@
1
- require File.expand_path('../boot', __FILE__)
1
+ require_relative 'boot'
2
2
 
3
3
  require 'action_controller/railtie'
4
4
  require 'action_mailer/railtie'
5
5
  require 'sprockets/railtie'
6
6
 
7
+ # Require the gems listed in Gemfile, including any gems
8
+ # you've limited to :test, :development, or :production.
7
9
  Bundler.require(*Rails.groups)
8
10
 
9
11
  module Example
10
12
  class Application < Rails::Application
13
+ config.load_defaults 5.2
11
14
  end
12
15
  end
@@ -0,0 +1,3 @@
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2
+
3
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
@@ -1,5 +1,5 @@
1
1
  # Load the Rails application.
2
- require File.expand_path('../application', __FILE__)
2
+ require_relative 'application'
3
3
 
4
4
  # Initialize the Rails application.
5
5
  Rails.application.initialize!
File without changes
@@ -1,4 +1,5 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require ::File.expand_path('../config/environment', __FILE__)
3
+ require_relative 'config/environment'
4
+
4
5
  run Rails.application
@@ -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,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', '~> 6.1.7'
4
+ gem 'webrick' if RUBY_VERSION >= '3'
5
+ gem 'premailer-rails', path: '../..'
@@ -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_relative 'config/application'
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1 @@
1
+ //= link email.css
@@ -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
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path("../config/application", __dir__)
3
+ require_relative "../config/boot"
4
+ require "rails/commands"
@@ -0,0 +1,15 @@
1
+ require_relative 'boot'
2
+
3
+ require 'action_controller/railtie'
4
+ require 'action_mailer/railtie'
5
+ require 'sprockets/railtie'
6
+
7
+ # Require the gems listed in Gemfile, including any gems
8
+ # you've limited to :test, :development, or :production.
9
+ Bundler.require(*Rails.groups)
10
+
11
+ module Example
12
+ class Application < Rails::Application
13
+ config.load_defaults 6.1
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2
+
3
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require_relative 'application'
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,9 @@
1
+ Rails.application.configure do
2
+ config.cache_classes = false
3
+ config.eager_load = false
4
+ config.consider_all_requests_local = true
5
+ config.action_controller.perform_caching = false
6
+ config.assets.debug = true
7
+ config.assets.digest = true
8
+ config.assets.raise_runtime_errors = true
9
+ end
@@ -0,0 +1,9 @@
1
+ Rails.application.configure do
2
+ config.cache_classes = true
3
+ config.eager_load = true
4
+ config.consider_all_requests_local = false
5
+ config.action_controller.perform_caching = true
6
+ config.assets.compile = false
7
+ config.assets.digest = true
8
+ config.log_level = :info
9
+ 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,6 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require_relative 'config/environment'
4
+
5
+ run Rails.application
6
+ Rails.application.load_server
@@ -0,0 +1,5 @@
1
+ class ExampleMailerPreview < ActionMailer::Preview
2
+ def test_message
3
+ ExampleMailer.test_message
4
+ end
5
+ end
@@ -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,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', '~> 7.0.4'
4
+ gem 'propshaft'
5
+ gem 'webrick' if RUBY_VERSION >= '3'
6
+ gem 'premailer-rails', path: '../..'
@@ -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_relative 'config/application'
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
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path("../config/application", __dir__)
3
+ require_relative "../config/boot"
4
+ require "rails/commands"
@@ -0,0 +1,14 @@
1
+ require_relative 'boot'
2
+
3
+ require 'action_controller/railtie'
4
+ require 'action_mailer/railtie'
5
+
6
+ # Require the gems listed in Gemfile, including any gems
7
+ # you've limited to :test, :development, or :production.
8
+ Bundler.require(*Rails.groups)
9
+
10
+ module Example
11
+ class Application < Rails::Application
12
+ config.load_defaults 7.0
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2
+
3
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require_relative 'application'
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,9 @@
1
+ Rails.application.configure do
2
+ config.cache_classes = false
3
+ config.eager_load = false
4
+ config.consider_all_requests_local = true
5
+ config.action_controller.perform_caching = false
6
+ config.assets.debug = true
7
+ config.assets.digest = true
8
+ config.assets.raise_runtime_errors = true
9
+ end
@@ -0,0 +1,9 @@
1
+ Rails.application.configure do
2
+ config.cache_classes = true
3
+ config.eager_load = true
4
+ config.consider_all_requests_local = false
5
+ config.action_controller.perform_caching = true
6
+ config.assets.compile = false
7
+ config.assets.digest = true
8
+ config.log_level = :info
9
+ 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,6 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require_relative 'config/environment'
4
+
5
+ run Rails.application
6
+ Rails.application.load_server
@@ -0,0 +1,5 @@
1
+ class ExampleMailerPreview < ActionMailer::Preview
2
+ def test_message
3
+ ExampleMailer.test_message
4
+ end
5
+ end