hanami-mailer 1.3.2 → 1.3.3
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/LICENSE.md +1 -1
- data/README.md +2 -3
- data/hanami-mailer.gemspec +22 -19
- data/lib/hanami-mailer.rb +3 -1
- data/lib/hanami/mailer.rb +20 -15
- data/lib/hanami/mailer/configuration.rb +9 -7
- data/lib/hanami/mailer/dsl.rb +4 -2
- data/lib/hanami/mailer/rendering/template_name.rb +5 -3
- data/lib/hanami/mailer/rendering/templates_finder.rb +7 -5
- data/lib/hanami/mailer/template.rb +3 -1
- data/lib/hanami/mailer/version.rb +3 -1
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aaa9852dec3800b06a8282dd1ee9d7c3c74a0acdac120657de03283ba1925d6a
|
4
|
+
data.tar.gz: ff87640e34325a09d94657ff0358cb456ff1f96826111df68b4f628619f95525
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9a4c8d1f3463a2378f587ddcb20c24cf281afd4c033f725df476e4a0b12d67ddaba90618bc73d5bd9bc614263d8bc257eba0e9922a8e30ae9367a0b86e4686e
|
7
|
+
data.tar.gz: 1ee77f48da2d39f1669e901b0f57981ffa89026283b8c37070900fcc5fe65d192850b6c2774b851c901fc8a7567c45c27056dc996783fa9e03a8470dbbe11923
|
data/CHANGELOG.md
CHANGED
data/LICENSE.md
CHANGED
data/README.md
CHANGED
@@ -5,8 +5,7 @@ Mail for Ruby applications.
|
|
5
5
|
## Status
|
6
6
|
|
7
7
|
[](https://badge.fury.io/rb/hanami-mailer)
|
8
|
-
[](https://circleci.com/gh/hanami/mailer/tree/master)
|
8
|
+
[](https://github.com/hanami/mailer/actions?query=workflow%3Aci+branch%3Amaster)
|
10
9
|
[](https://codecov.io/gh/hanami/mailer)
|
11
10
|
[](https://depfu.com/github/hanami/mailer?project=Bundler)
|
12
11
|
[](http://inch-ci.org/github/hanami/mailer)
|
@@ -416,6 +415,6 @@ __Hanami::Mailer__ uses [Semantic Versioning 2.0.0](http://semver.org)
|
|
416
415
|
|
417
416
|
## Copyright
|
418
417
|
|
419
|
-
Copyright © 2015-
|
418
|
+
Copyright © 2015-2021 Luca Guidi – Released under MIT License
|
420
419
|
|
421
420
|
This project was formerly known as Lotus (`lotus-mailer`).
|
data/hanami-mailer.gemspec
CHANGED
@@ -1,29 +1,32 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require
|
5
|
+
require "hanami/mailer/version"
|
4
6
|
|
5
7
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name =
|
8
|
+
spec.name = "hanami-mailer"
|
7
9
|
spec.version = Hanami::Mailer::VERSION
|
8
|
-
spec.authors = [
|
9
|
-
spec.email = [
|
10
|
+
spec.authors = ["Luca Guidi"]
|
11
|
+
spec.email = ["me@lucaguidi.com"]
|
10
12
|
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
13
|
+
spec.summary = "Mail for Ruby applications."
|
14
|
+
spec.description = "Mail for Ruby applications and Hanami mailers"
|
15
|
+
spec.homepage = "http://hanamirb.org"
|
16
|
+
spec.license = "MIT"
|
15
17
|
|
16
|
-
spec.files = `git ls-files -- lib/* CHANGELOG.md LICENSE.md README.md hanami-mailer.gemspec`.split($/)
|
17
|
-
spec.bindir =
|
18
|
+
spec.files = `git ls-files -- lib/* CHANGELOG.md LICENSE.md README.md hanami-mailer.gemspec`.split($/)
|
19
|
+
spec.bindir = "exe"
|
18
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
-
spec.require_paths = [
|
20
|
-
spec.required_ruby_version =
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
spec.required_ruby_version = ">= 2.3.0"
|
21
23
|
|
22
|
-
spec.add_dependency
|
23
|
-
spec.add_dependency
|
24
|
-
spec.add_dependency
|
24
|
+
spec.add_dependency "hanami-utils", "~> 1.3"
|
25
|
+
spec.add_dependency "tilt", "~> 2.0", ">= 2.0.1"
|
26
|
+
spec.add_dependency "mail", "~> 2.6"
|
25
27
|
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
28
|
+
spec.add_development_dependency "bundler", ">= 1.6", "< 3"
|
29
|
+
spec.add_development_dependency "rake", "~> 13"
|
30
|
+
spec.add_development_dependency "rspec", "~> 3.7"
|
31
|
+
spec.add_development_dependency "rubocop", "0.81" # rubocop 0.81+ removed support for Ruby 2.3
|
29
32
|
end
|
data/lib/hanami-mailer.rb
CHANGED
data/lib/hanami/mailer.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "hanami/utils/class_attribute"
|
4
|
+
require "hanami/mailer/version"
|
5
|
+
require "hanami/mailer/configuration"
|
6
|
+
require "hanami/mailer/dsl"
|
7
|
+
require "mail"
|
6
8
|
|
7
9
|
# Hanami
|
8
10
|
#
|
@@ -34,8 +36,8 @@ module Hanami
|
|
34
36
|
# @since 0.1.0
|
35
37
|
# @api private
|
36
38
|
CONTENT_TYPES = {
|
37
|
-
html:
|
38
|
-
txt:
|
39
|
+
html: "text/html",
|
40
|
+
txt: "text/plain"
|
39
41
|
}.freeze
|
40
42
|
|
41
43
|
include Utils::ClassAttribute
|
@@ -181,10 +183,17 @@ module Hanami
|
|
181
183
|
# invoice = Invoice.new
|
182
184
|
# user = User.new(name: 'L', email: 'user@example.com')
|
183
185
|
#
|
184
|
-
#
|
185
|
-
# Billing::Invoice.deliver(invoice: invoice, user: user
|
186
|
-
#
|
187
|
-
#
|
186
|
+
# # Deliver both text, HTML parts and the attachment
|
187
|
+
# Billing::Invoice.deliver(invoice: invoice, user: user)
|
188
|
+
#
|
189
|
+
# # Deliver only the text part and the attachment
|
190
|
+
# Billing::Invoice.deliver(invoice: invoice, user: user, format: :txt)
|
191
|
+
#
|
192
|
+
# # Deliver only the text part and the attachment
|
193
|
+
# Billing::Invoice.deliver(invoice: invoice, user: user, format: :html)
|
194
|
+
#
|
195
|
+
# # Deliver both the parts with "iso-8859"
|
196
|
+
# Billing::Invoice.deliver(invoice: invoice, user: user, charset: "iso-8859")
|
188
197
|
def deliver(locals = {})
|
189
198
|
new(locals).deliver
|
190
199
|
end
|
@@ -280,8 +289,6 @@ module Hanami
|
|
280
289
|
|
281
290
|
private
|
282
291
|
|
283
|
-
# rubocop:disable Metrics/MethodLength
|
284
|
-
# rubocop:disable Metrics/AbcSize
|
285
292
|
def build
|
286
293
|
Mail.new.tap do |m|
|
287
294
|
m.return_path = __dsl(:return_path)
|
@@ -299,8 +306,6 @@ module Hanami
|
|
299
306
|
m.delivery_method(*Hanami::Mailer.configuration.delivery_method)
|
300
307
|
end
|
301
308
|
end
|
302
|
-
# rubocop:enable Metrics/MethodLength
|
303
|
-
# rubocop:enable Metrics/AbcSize
|
304
309
|
|
305
310
|
# @api private
|
306
311
|
# @since 0.1.0
|
@@ -1,5 +1,7 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "set"
|
4
|
+
require "hanami/utils/kernel"
|
3
5
|
|
4
6
|
module Hanami
|
5
7
|
module Mailer
|
@@ -11,7 +13,7 @@ module Hanami
|
|
11
13
|
#
|
12
14
|
# @since 0.1.0
|
13
15
|
# @api private
|
14
|
-
DEFAULT_ROOT =
|
16
|
+
DEFAULT_ROOT = "."
|
15
17
|
|
16
18
|
# Default delivery method
|
17
19
|
#
|
@@ -23,7 +25,7 @@ module Hanami
|
|
23
25
|
#
|
24
26
|
# @since 0.1.0
|
25
27
|
# @api private
|
26
|
-
DEFAULT_CHARSET =
|
28
|
+
DEFAULT_CHARSET = "UTF-8"
|
27
29
|
|
28
30
|
# @since 0.1.0
|
29
31
|
# @api private
|
@@ -144,10 +146,10 @@ module Hanami
|
|
144
146
|
#
|
145
147
|
# @see Hanami::Mailer.configure
|
146
148
|
def prepare(&blk)
|
147
|
-
if block_given?
|
149
|
+
if block_given?
|
148
150
|
@modules.push(blk)
|
149
151
|
else
|
150
|
-
raise ArgumentError.new(
|
152
|
+
raise ArgumentError.new("Please provide a block")
|
151
153
|
end
|
152
154
|
end
|
153
155
|
|
@@ -191,7 +193,7 @@ module Hanami
|
|
191
193
|
@modules = []
|
192
194
|
end
|
193
195
|
|
194
|
-
|
196
|
+
alias_method :unload!, :reset!
|
195
197
|
|
196
198
|
# Copy the configuration for the given mailer
|
197
199
|
#
|
data/lib/hanami/mailer/dsl.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "hanami/mailer/rendering/template_name"
|
4
|
+
require "hanami/mailer/rendering/templates_finder"
|
3
5
|
|
4
6
|
module Hanami
|
5
7
|
module Mailer
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "hanami/utils/string"
|
2
4
|
|
3
5
|
module Hanami
|
4
6
|
module Mailer
|
@@ -10,7 +12,7 @@ module Hanami
|
|
10
12
|
class TemplateName
|
11
13
|
# @since 0.1.0
|
12
14
|
# @api private
|
13
|
-
NAMESPACE_SEPARATOR =
|
15
|
+
NAMESPACE_SEPARATOR = "::"
|
14
16
|
|
15
17
|
# @since 0.1.0
|
16
18
|
# @api private
|
@@ -45,7 +47,7 @@ module Hanami
|
|
45
47
|
# @since 0.1.0
|
46
48
|
# @api private
|
47
49
|
def replace!(token)
|
48
|
-
@name = @name.gsub(/\A#{token}#{NAMESPACE_SEPARATOR}/,
|
50
|
+
@name = @name.gsub(/\A#{token}#{NAMESPACE_SEPARATOR}/, "")
|
49
51
|
end
|
50
52
|
end
|
51
53
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "hanami/mailer/template"
|
2
4
|
|
3
5
|
module Hanami
|
4
6
|
module Mailer
|
@@ -14,19 +16,19 @@ module Hanami
|
|
14
16
|
#
|
15
17
|
# @api private
|
16
18
|
# @since 0.1.0
|
17
|
-
FORMAT =
|
19
|
+
FORMAT = "*"
|
18
20
|
|
19
21
|
# Default template engines
|
20
22
|
#
|
21
23
|
# @api private
|
22
24
|
# @since 0.1.0
|
23
|
-
ENGINES =
|
25
|
+
ENGINES = "*"
|
24
26
|
|
25
27
|
# Recursive pattern
|
26
28
|
#
|
27
29
|
# @api private
|
28
30
|
# @since 0.1.0
|
29
|
-
RECURSIVE =
|
31
|
+
RECURSIVE = "**"
|
30
32
|
|
31
33
|
# Initialize a finder
|
32
34
|
#
|
@@ -72,7 +74,7 @@ module Hanami
|
|
72
74
|
templates = Hash[]
|
73
75
|
_find.map do |template|
|
74
76
|
name = File.basename(template)
|
75
|
-
format = (name.split(
|
77
|
+
format = (name.split(".")[-2]).to_sym
|
76
78
|
templates[format] = Mailer::Template.new(template)
|
77
79
|
end
|
78
80
|
templates
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hanami-mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hanami-utils
|
@@ -106,6 +106,20 @@ dependencies:
|
|
106
106
|
- - "~>"
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: '3.7'
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
name: rubocop
|
111
|
+
requirement: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - '='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0.81'
|
116
|
+
type: :development
|
117
|
+
prerelease: false
|
118
|
+
version_requirements: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - '='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0.81'
|
109
123
|
description: Mail for Ruby applications and Hanami mailers
|
110
124
|
email:
|
111
125
|
- me@lucaguidi.com
|
@@ -129,7 +143,7 @@ homepage: http://hanamirb.org
|
|
129
143
|
licenses:
|
130
144
|
- MIT
|
131
145
|
metadata: {}
|
132
|
-
post_install_message:
|
146
|
+
post_install_message:
|
133
147
|
rdoc_options: []
|
134
148
|
require_paths:
|
135
149
|
- lib
|
@@ -144,8 +158,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
158
|
- !ruby/object:Gem::Version
|
145
159
|
version: '0'
|
146
160
|
requirements: []
|
147
|
-
rubygems_version: 3.
|
148
|
-
signing_key:
|
161
|
+
rubygems_version: 3.2.4
|
162
|
+
signing_key:
|
149
163
|
specification_version: 4
|
150
164
|
summary: Mail for Ruby applications.
|
151
165
|
test_files: []
|