premailer-rails 1.9.5 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/test.yml +64 -0
  3. data/.gitignore +4 -0
  4. data/CHANGELOG.md +40 -0
  5. data/Gemfile +15 -11
  6. data/README.md +32 -37
  7. data/VERSION +1 -1
  8. data/examples/rails5/Gemfile +4 -0
  9. data/{example → examples/rails5}/Rakefile +1 -1
  10. data/{example → examples/rails5}/bin/rails +1 -1
  11. data/{example → examples/rails5}/config/application.rb +4 -1
  12. data/examples/rails5/config/boot.rb +3 -0
  13. data/{example → examples/rails5}/config/environment.rb +1 -1
  14. data/{example → examples/rails5}/config.ru +2 -1
  15. data/examples/rails6/.gitignore +16 -0
  16. data/examples/rails6/Gemfile +5 -0
  17. data/examples/rails6/README.md +10 -0
  18. data/examples/rails6/Rakefile +6 -0
  19. data/examples/rails6/app/assets/config/manifest.js +1 -0
  20. data/examples/rails6/app/assets/stylesheets/email.css +32 -0
  21. data/examples/rails6/app/mailers/example_mailer.rb +7 -0
  22. data/examples/rails6/app/views/example_mailer/test_message.html.erb +18 -0
  23. data/examples/rails6/bin/rails +4 -0
  24. data/examples/rails6/config/application.rb +15 -0
  25. data/examples/rails6/config/boot.rb +3 -0
  26. data/examples/rails6/config/environment.rb +5 -0
  27. data/examples/rails6/config/environments/development.rb +9 -0
  28. data/examples/rails6/config/environments/production.rb +9 -0
  29. data/examples/rails6/config/routes.rb +3 -0
  30. data/examples/rails6/config.ru +6 -0
  31. data/examples/rails6/test/mailers/previews/example_mailer_preview.rb +5 -0
  32. data/examples/rails7-propshaft/.gitignore +16 -0
  33. data/examples/rails7-propshaft/Gemfile +6 -0
  34. data/examples/rails7-propshaft/README.md +10 -0
  35. data/examples/rails7-propshaft/Rakefile +6 -0
  36. data/examples/rails7-propshaft/app/assets/stylesheets/email.css +32 -0
  37. data/examples/rails7-propshaft/app/mailers/example_mailer.rb +7 -0
  38. data/examples/rails7-propshaft/app/views/example_mailer/test_message.html.erb +18 -0
  39. data/examples/rails7-propshaft/bin/rails +4 -0
  40. data/examples/rails7-propshaft/config/application.rb +14 -0
  41. data/examples/rails7-propshaft/config/boot.rb +3 -0
  42. data/examples/rails7-propshaft/config/environment.rb +5 -0
  43. data/examples/rails7-propshaft/config/environments/development.rb +9 -0
  44. data/examples/rails7-propshaft/config/environments/production.rb +9 -0
  45. data/examples/rails7-propshaft/config/routes.rb +3 -0
  46. data/examples/rails7-propshaft/config.ru +6 -0
  47. data/examples/rails7-propshaft/test/mailers/previews/example_mailer_preview.rb +5 -0
  48. data/examples/rails7-sprockets/.gitignore +16 -0
  49. data/examples/rails7-sprockets/Gemfile +6 -0
  50. data/examples/rails7-sprockets/README.md +10 -0
  51. data/examples/rails7-sprockets/Rakefile +6 -0
  52. data/examples/rails7-sprockets/app/assets/config/manifest.js +1 -0
  53. data/examples/rails7-sprockets/app/assets/stylesheets/email.css +32 -0
  54. data/examples/rails7-sprockets/app/mailers/example_mailer.rb +7 -0
  55. data/examples/rails7-sprockets/app/views/example_mailer/test_message.html.erb +18 -0
  56. data/examples/rails7-sprockets/bin/rails +4 -0
  57. data/examples/rails7-sprockets/config/application.rb +14 -0
  58. data/examples/rails7-sprockets/config/boot.rb +3 -0
  59. data/examples/rails7-sprockets/config/environment.rb +5 -0
  60. data/examples/rails7-sprockets/config/environments/development.rb +9 -0
  61. data/examples/rails7-sprockets/config/environments/production.rb +9 -0
  62. data/examples/rails7-sprockets/config/routes.rb +3 -0
  63. data/examples/rails7-sprockets/config.ru +6 -0
  64. data/examples/rails7-sprockets/test/mailers/previews/example_mailer_preview.rb +5 -0
  65. data/lib/premailer/rails/css_helper.rb +32 -11
  66. data/lib/premailer/rails/css_loaders/asset_pipeline_loader.rb +16 -15
  67. data/lib/premailer/rails/css_loaders/file_system_loader.rb +24 -2
  68. data/lib/premailer/rails/css_loaders/network_loader.rb +2 -2
  69. data/lib/premailer/rails/css_loaders/propshaft_loader.rb +38 -0
  70. data/lib/premailer/rails/css_loaders.rb +1 -1
  71. data/lib/premailer/rails/customized_premailer.rb +4 -4
  72. data/lib/premailer/rails/hook.rb +2 -6
  73. data/lib/premailer/rails/railtie.rb +1 -1
  74. data/lib/premailer/rails.rb +2 -1
  75. data/premailer-rails.gemspec +4 -3
  76. data/spec/integration/css_helper_spec.rb +262 -129
  77. data/spec/integration/delivery_spec.rb +13 -0
  78. data/spec/integration/hook_spec.rb +36 -11
  79. data/spec/rails_app/app/assets/config/manifest.js +3 -0
  80. data/spec/rails_app/app/assets/stylesheets/application.css +3 -0
  81. data/spec/rails_app/app/mailers/application_mailer.rb +4 -0
  82. data/spec/rails_app/app/mailers/welcome_mailer.rb +6 -0
  83. data/spec/rails_app/app/views/layouts/mailer.html.erb +11 -0
  84. data/spec/rails_app/app/views/welcome_mailer/welcome_email.html.erb +1 -0
  85. data/spec/rails_app/config/application.rb +19 -0
  86. data/spec/rails_app/config/boot.rb +5 -0
  87. data/spec/rails_app/config/environment.rb +2 -0
  88. data/spec/rails_app/config/environments/test.rb +10 -0
  89. data/spec/rails_app/config/initializers/assets.rb +1 -0
  90. data/spec/rails_app/config/routes.rb +3 -0
  91. data/spec/rails_app/config.ru +5 -0
  92. data/spec/rails_app/log/.keep +0 -0
  93. data/spec/rails_app/tmp/.keep +0 -0
  94. data/spec/spec_helper.rb +3 -17
  95. data/spec/support/fixtures/message.rb +40 -0
  96. data/spec/unit/css_loaders/asset_pipeline_loader_spec.rb +44 -32
  97. data/spec/unit/css_loaders/file_system_loader_spec.rb +37 -0
  98. data/spec/unit/css_loaders/network_loader_spec.rb +1 -1
  99. data/spec/unit/css_loaders/propshaft_loader_spec.rb +57 -0
  100. data/spec/unit/customized_premailer_spec.rb +32 -40
  101. metadata +121 -81
  102. data/.coveralls.yml +0 -1
  103. data/.travis.yml +0 -22
  104. data/example/Gemfile +0 -10
  105. data/example/config/boot.rb +0 -3
  106. data/example/config/secrets.yml +0 -2
  107. data/lib/premailer/rails/css_loaders/cache_loader.rb +0 -29
  108. data/spec/integration/hook_registration_spec.rb +0 -11
  109. data/spec/support/stubs/action_mailer.rb +0 -5
  110. data/spec/support/stubs/rails.rb +0 -51
  111. /data/{example → examples/rails5}/.gitignore +0 -0
  112. /data/{example → examples/rails5}/README.md +0 -0
  113. /data/{example → examples/rails5}/app/assets/stylesheets/email.css +0 -0
  114. /data/{example → examples/rails5}/app/mailers/example_mailer.rb +0 -0
  115. /data/{example → examples/rails5}/app/views/example_mailer/test_message.html.erb +0 -0
  116. /data/{example → examples/rails5}/config/environments/development.rb +0 -0
  117. /data/{example → examples/rails5}/config/environments/production.rb +0 -0
  118. /data/{example → examples/rails5}/config/initializers/assets.rb +0 -0
  119. /data/{example → examples/rails5}/config/routes.rb +0 -0
  120. /data/{example → examples/rails5}/test/mailers/previews/example_mailer_preview.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1d3d9d793a427df886ea2b99af60ce466db67bd2
4
- data.tar.gz: 3849875af6ec63a8194008c94ab543a0b8fbd920
2
+ SHA256:
3
+ metadata.gz: d1ade699bd19b081f52953b727ac7d58019325a8724ebcb49f95158eb832b10d
4
+ data.tar.gz: 380a46fefaa3d09f491975b45d47590af610d72965ce7c6190b94aeb78a57a6d
5
5
  SHA512:
6
- metadata.gz: e99f797aaa7f53584f5b8b63b5a20358be04e70a6c3677774abaf04814ceb1574393b7532dad24e36c5accc2ab86bed46aac6efc7967534afb1a5d9880be1dfe
7
- data.tar.gz: 17df1bf7a56bba9ed2474f85012b78d810b924b28efe756827ae66494a5948065dbb4f1aeae8dfc94744d2a830e18fd7f82ade8a90ec63f60a41481623c4e64d
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/.gitignore CHANGED
@@ -2,3 +2,7 @@
2
2
  doc/
3
3
  Gemfile.lock
4
4
  coverage/
5
+ spec/rails_app/log/*
6
+ spec/rails_app/tmp/*
7
+ .ruby-version
8
+ /.bundle
data/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
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
+
9
+ ## v1.11.1
10
+
11
+ - Check if `Rails.application` is defined (@pabloh, #250)
12
+
13
+ ## v1.11.0
14
+
15
+ - Remove `force_encoding!`
16
+
17
+ ## v1.10.3
18
+
19
+ - Remove upper version constraint for actionmailer
20
+
21
+ ## v1.10.2
22
+
23
+ - Explicitly check for assets_manifest (@derekwheel, #214)
24
+
25
+ ## v1.10.1
26
+
27
+ - Catch error when sprockets can't find asset (@kirs, #209)
28
+
29
+ ## v1.10.0
30
+
31
+ - Drop support for hpricot now that premailer-rails also doesn't support it
32
+ - Use `Rails.application.assets_manifest` instead of `Rails.application.assets` in Asset Pipeline loader (@kirs, #201)
33
+ - Introduce `:strategies` config option that allows to control CSS fetching stragies
34
+
35
+ ## v1.9.7
36
+
37
+ - Use `Rails.root` in `FileSystemLoader` (@stanhu, #195)
38
+
39
+ ## v1.9.6
40
+
41
+ - Handle `relative_url_root` in when loading CSS from file system
42
+
3
43
  ## v1.9.5
4
44
 
5
45
  - Mention license in gemspec
data/Gemfile CHANGED
@@ -1,20 +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
- action_mailer_version = ENV.fetch('ACTION_MAILER_VERSION', '4')
6
+ rails_version = ENV.fetch('ACTION_MAILER_VERSION', '7')
6
7
 
7
- if action_mailer_version == 'master'
8
- git 'git://github.com/rails/rails.git' do
9
- gem 'actionmailer'
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
15
  else
12
- gem 'actionmailer', "~> #{action_mailer_version}"
13
- end
14
-
15
- platforms :rbx do
16
- gem 'rubysl'
17
- gem 'racc'
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
18
22
  end
19
23
 
20
- gem 'tins', '< 1.7' if RUBY_VERSION.split('.').first.to_i < 2
24
+ gem 'byebug'
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
 
@@ -39,34 +37,34 @@ styled emails without having to set anything up.
39
37
  Whenever premailer-rails processes an email, it collects the URLs of all linked
40
38
  stylesheets (`<link rel="stylesheet" href="css_url">`). Then, for each of these
41
39
  URLs, it tries to get the content through a couple of strategies. As long as
42
- a strategy does not return anything, the next one is used. The strategies and
43
- their order are as follows:
40
+ a strategy does not return anything, the next one is used. The strategies
41
+ available are:
44
42
 
45
- 1. **Cache:** If there's a file in cache matching that URL, the cache content
46
- is returned. The cache right now is rather rudimentary. Whenever a CSS file
47
- is retrieved, it is stored in memory such that subsequent requests to the
48
- same file are faster. The caching is disabled inside Rails in the
49
- development environment.
50
-
51
- 2. **File System:** If there's a file inside `public/` with the same path as in
43
+ - `:filesystem`: If there's a file inside `public/` with the same path as in
52
44
  the URL, it is read from disk. E.g. if the URL is
53
45
  `http://cdn.example.com/assets/email.css` the contents of the file located
54
46
  at `public/assets/email.css` gets returned if it exists.
55
47
 
56
- 3. **Asset Pipeline:** If Rails is available and the asset pipeline is enabled,
48
+ - `:asset_pipeline`: If Rails is available and the asset pipeline is enabled,
57
49
  the file is retrieved through the asset pipeline. E.g. if the URL is
58
50
  `http://cdn.example.com/assets/email-fingerprint123.css`, the file
59
51
  `email.css` is requested from the asset pipeline. That is, the fingerprint
60
52
  and the prefix (in this case `assets` is the prefix) are stripped before
61
53
  requesting it from the asset pipeline.
62
54
 
63
- 4. **Network:** As a last resort, the URL is simply requested and the response
64
- body is used. This is usefull when the assets are not bundled in the
55
+ - `:network`: As a last resort, the URL is simply requested and the response
56
+ body is used. This is useful when the assets are not bundled in the
65
57
  application and only available on a CDN. On Heroku e.g. you can add assets
66
58
  to your `.slugignore` causing your assets to not be available to the app
67
59
  (and thus resulting in a smaller app) and deploy the assets to a CDN such
68
60
  as S3/CloudFront.
69
61
 
62
+ You can configure which strategies you want to use as well as specify their
63
+ order. Refer to the *Configuration* section for more on this.
64
+
65
+ Note that the retrieved CSS is cached when the gem is running with Rails in
66
+ production.
67
+
70
68
  ## Installation
71
69
 
72
70
  Simply add the gem to your `Gemfile`:
@@ -75,19 +73,12 @@ Simply add the gem to your `Gemfile`:
75
73
  gem 'premailer-rails'
76
74
  ```
77
75
 
78
- premailer-rails requires either [nokogiri] or [hpricot]. It doesn't list them as
79
- a dependency so you can choose which one to use. Since hpricot is no longer
80
- maintained, I suggest you to go with nokogiri. Add either one to your `Gemfile`:
81
-
82
- ```ruby
83
- gem 'nokogiri'
84
- # or
85
- gem 'hpricot'
86
- ```
87
-
88
- If both gems are loaded for some reason, premailer chooses hpricot.
89
-
90
- That's it!
76
+ premailer-rails and premailer require a gem that is used to parse the email's
77
+ HTML. For a list of supported gems and how to select which one to use, please
78
+ refer to the [*Adapter*
79
+ section](https://github.com/premailer/premailer#adapters) of premailer. Note
80
+ that there is no hard dependency from either gem so you should add one yourself.
81
+ Also note that this gem is only tested with [nokogiri].
91
82
 
92
83
  ## Configuration
93
84
 
@@ -106,7 +97,8 @@ configs are:
106
97
  ```ruby
107
98
  {
108
99
  input_encoding: 'UTF-8',
109
- generate_text_part: true
100
+ generate_text_part: true,
101
+ strategies: [:filesystem, :asset_pipeline, :network]
110
102
  }
111
103
  ```
112
104
 
@@ -158,6 +150,14 @@ Premailer::Rails::Hook.perform(mail)
158
150
 
159
151
  This will modify the email in place, useful e.g. in tests.
160
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
+
161
161
  ## Small Print
162
162
 
163
163
  ### Author
@@ -168,25 +168,20 @@ Philipe Fatio ([@fphilipe][fphilipe twitter])
168
168
 
169
169
  premailer-rails is released under the MIT license. See the [license file].
170
170
 
171
- [build-image]: https://travis-ci.org/fphilipe/premailer-rails.svg
172
- [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
173
173
  [gem-image]: https://badge.fury.io/rb/premailer-rails.svg
174
174
  [gem-link]: https://rubygems.org/gems/premailer-rails
175
- [deps-image]: https://gemnasium.com/fphilipe/premailer-rails.svg
176
- [deps-link]: https://gemnasium.com/fphilipe/premailer-rails
177
175
  [gpa-image]: https://codeclimate.com/github/fphilipe/premailer-rails.svg
178
176
  [gpa-link]: https://codeclimate.com/github/fphilipe/premailer-rails
179
- [cov-image]: https://coveralls.io/repos/fphilipe/premailer-rails/badge.svg
180
- [cov-link]: https://coveralls.io/r/fphilipe/premailer-rails
181
177
  [tip-image]: https://rawgithub.com/twolfson/gittip-badge/0.1.0/dist/gittip.svg
182
178
  [tip-link]: https://www.gittip.com/fphilipe/
183
179
 
184
180
  [premailer]: https://github.com/premailer/premailer
185
- [actionmailer]: https://github.com/rails/rails/tree/master/actionmailer
181
+ [actionmailer]: https://github.com/rails/rails/tree/main/actionmailer
186
182
  [nokogiri]: https://github.com/sparklemotion/nokogiri
187
- [hpricot]: https://github.com/hpricot/hpricot
188
183
 
189
- [premailer documentation]: http://rubydoc.info/gems/premailer/1.7.3/Premailer:initialize
184
+ [premailer documentation]: https://www.rubydoc.info/gems/premailer/Premailer:initialize
190
185
 
191
186
  [fphilipe twitter]: https://twitter.com/fphilipe
192
187
  [license file]: LICENSE
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.9.5
1
+ 1.12.0
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', '~> 5.2', '>= 5.2.8.1'
4
+ gem 'premailer-rails', path: '../..'
@@ -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!
@@ -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