maily 0.8.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.travis.yml +2 -8
- data/CHANGELOG.md +11 -0
- data/MIT-LICENSE +1 -1
- data/README.md +15 -1
- data/lib/maily.rb +2 -2
- data/lib/maily/version.rb +1 -1
- data/spec/maily_spec.rb +13 -0
- data/spec/spec_helper.rb +14 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2d25ed66b110f246b500c8c63d8d7648518d22949cfd76e6664a6c233310d0c6
|
4
|
+
data.tar.gz: 7c32d79ef886352180368a8a9a9c8163f35f72f7494ecab37f0b53c2a43512aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb919cb4b0d387c7463b1ba8b9615e490c90d5ee619b2fd525d313f8ade607d0ea02f95551e76c1dc069733ffd5c962ff553da9346fbe9497cef31a266141236
|
7
|
+
data.tar.gz: f3c63ae889fd4c6a125edc09ad29a003eccbd253fd5bb8146dd37e302584c609792a364f13150e5567287093c7178e9f1bdcb77c7449f34ef505eeac6712b80b
|
data/.travis.yml
CHANGED
@@ -1,22 +1,16 @@
|
|
1
1
|
language: ruby
|
2
|
-
|
3
2
|
cache: bundler
|
4
|
-
|
5
|
-
sudo: false
|
6
|
-
|
7
3
|
rvm:
|
8
4
|
- ruby-head
|
5
|
+
- 2.6.0
|
9
6
|
- 2.5.3
|
10
7
|
- 2.4.5
|
11
8
|
- 2.3.8
|
12
|
-
- 2.2.10
|
13
|
-
|
14
9
|
gemfile:
|
15
10
|
- gemfiles/rails_5.2.gemfile
|
16
11
|
- gemfiles/rails_5.1.gemfile
|
17
12
|
- gemfiles/rails_5.0.gemfile
|
18
13
|
- gemfiles/rails_4.2.gemfile
|
19
|
-
|
20
14
|
matrix:
|
21
15
|
allow_failures:
|
22
|
-
- rvm: ruby-head
|
16
|
+
- rvm: ruby-head
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
+
## [0.9.0]
|
6
|
+
|
7
|
+
- Allow to register external mailers, for example, from a gem
|
8
|
+
- CI Rubies: add 2.6 and drop 2.2 (EOL)
|
9
|
+
|
10
|
+
## [0.8.2]
|
11
|
+
|
12
|
+
- Fix incompatibility with last gem `mail` (v2.7.1) release (#32)
|
13
|
+
|
5
14
|
## [0.8.1]
|
6
15
|
|
7
16
|
- Serve fonts from Google Fonts API
|
@@ -94,6 +103,8 @@ All notable changes to this project will be documented in this file.
|
|
94
103
|
|
95
104
|
- First real usable release :tada:
|
96
105
|
|
106
|
+
[0.9.0]: https://github.com/markets/maily/compare/v0.8.2...v0.9.0
|
107
|
+
[0.8.2]: https://github.com/markets/maily/compare/v0.8.1...v0.8.2
|
97
108
|
[0.8.1]: https://github.com/markets/maily/compare/v0.8.0...v0.8.1
|
98
109
|
[0.8.0]: https://github.com/markets/maily/compare/v0.7.2...v0.8.0
|
99
110
|
[0.7.2]: https://github.com/markets/maily/compare/v0.7.1...v0.7.2
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Maily
|
2
2
|
|
3
|
-
[](https://rubygems.org/gems/maily)
|
4
4
|
[](https://travis-ci.org/markets/maily)
|
5
5
|
[](https://codeclimate.com/github/markets/maily/maintainability)
|
6
6
|
|
@@ -139,6 +139,20 @@ Maily.hooks_for('Notifier') do |mailer|
|
|
139
139
|
end
|
140
140
|
```
|
141
141
|
|
142
|
+
### External emails
|
143
|
+
|
144
|
+
If you want to register and display in the UI, emails from external sources, like for example a gem, you can do it by adding a hook. Example:
|
145
|
+
|
146
|
+
```ruby
|
147
|
+
Maily.hooks_for('Devise::Mailer') do |mailer|
|
148
|
+
mailer.hide_email(:unlock_instructions)
|
149
|
+
|
150
|
+
mailer.register_hook(:reset_password_instructions, user, 'random_token')
|
151
|
+
mailer.register_hook(:confirmation_instructions, user, 'random_token')
|
152
|
+
mailer.register_hook(:password_change, user)
|
153
|
+
end
|
154
|
+
```
|
155
|
+
|
142
156
|
## Authorization
|
143
157
|
|
144
158
|
Basically, you have 2 ways to restrict access to the `Maily` section. You can even combine both.
|
data/lib/maily.rb
CHANGED
@@ -33,8 +33,8 @@ module Maily
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def hooks_for(mailer_name)
|
36
|
-
|
37
|
-
|
36
|
+
mailer_name = mailer_name.underscore
|
37
|
+
mailer = Maily::Mailer.find(mailer_name) || Maily::Mailer.new(mailer_name)
|
38
38
|
|
39
39
|
yield(mailer) if block_given?
|
40
40
|
end
|
data/lib/maily/version.rb
CHANGED
data/spec/maily_spec.rb
CHANGED
@@ -26,4 +26,17 @@ describe Maily do
|
|
26
26
|
expect(Maily.allowed_action?(:deliver)).to be false
|
27
27
|
end
|
28
28
|
end
|
29
|
+
|
30
|
+
describe '#hooks_for' do
|
31
|
+
it "allows to register external hooks" do
|
32
|
+
class ExternalMailer < ActionMailer::Base
|
33
|
+
def external_email
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
Maily.hooks_for('ExternalMailer')
|
38
|
+
|
39
|
+
expect(Maily::Mailer.find('external_mailer').emails.count).to eq 1
|
40
|
+
end
|
41
|
+
end
|
29
42
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -8,3 +8,17 @@ RSpec.configure do |config|
|
|
8
8
|
config.mock_with :rspec
|
9
9
|
config.order = 'random'
|
10
10
|
end
|
11
|
+
|
12
|
+
# Rails 4.2 call `initialize` inside `recycle!`. However Ruby 2.6 doesn't allow calling `initialize` twice.
|
13
|
+
# More info: https://github.com/rails/rails/issues/34790
|
14
|
+
if RUBY_VERSION >= "2.6.0" && Rails.version < "5"
|
15
|
+
module ActionController
|
16
|
+
class TestResponse < ActionDispatch::TestResponse
|
17
|
+
def recycle!
|
18
|
+
@mon_mutex_owner_object_id = nil
|
19
|
+
@mon_mutex = nil
|
20
|
+
initialize
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maily
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- markets
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
201
|
version: '0'
|
202
202
|
requirements: []
|
203
203
|
rubyforge_project:
|
204
|
-
rubygems_version: 2.6
|
204
|
+
rubygems_version: 2.7.6
|
205
205
|
signing_key:
|
206
206
|
specification_version: 4
|
207
207
|
summary: Rails Engine to preview emails in the browser.
|