template_mailer 0.0.3 → 0.0.4
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcbff2c8ba6f4412ac5dfce609bc642f01a0bf5c6db44429903de6f6e3fa42af
|
4
|
+
data.tar.gz: 17f19bbc4f362b834683c4ef35acf4eebf75ef4c0f43160336a5eebb5f6047d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce782d8647c7bf6bc06517d20167a962f41bdd38646915d1401ccb5fdf3f93468fa71c0e6ba2112a6372f277baf19bf4c6f2876e1142987aae215a85306733ef
|
7
|
+
data.tar.gz: c3f3dcc627e9dbc9dcd571fe65097204e00c3697acefc396a131b793efc99f3e4daecc6bf9ccd38d57b7432047ed24d258ec8ce02ca42cfa60aabe6fef2b12f2
|
data/README.md
CHANGED
@@ -47,12 +47,12 @@ folder the code to create a ```Mailer``` might look as follows...
|
|
47
47
|
```ruby
|
48
48
|
mailer = TemplateMailer::Mailer.new(directory: "/templates",
|
49
49
|
server: {address: 'mymail.smtp.com',
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
50
|
+
port: '587',
|
51
|
+
enable_starttls_auto: true,
|
52
|
+
user_name: 'mymailuser',
|
53
|
+
password: 'password',
|
54
|
+
authentication: :login,
|
55
|
+
domain: "mydomain.com"},
|
56
56
|
via: :smtp)
|
57
57
|
```
|
58
58
|
|
@@ -70,7 +70,7 @@ based clients then create to files in the template directory with ```.text``` an
|
|
70
70
|
generate content from them both for the email message to be sent.
|
71
71
|
|
72
72
|
Note that when calling ```generate_mail()``` you can pass a Hash of context
|
73
|
-
|
73
|
+
parameters as the second parameter to the method call. The values within this
|
74
74
|
Hash will be available to populate the message templates with. So, for example,
|
75
75
|
if you wanted to pass in a parameter called full name you would make a call that
|
76
76
|
looked like this...
|
@@ -53,13 +53,15 @@ module TemplateMailer
|
|
53
53
|
# recognised as templates based on extensions from the object itself and
|
54
54
|
# the engine it possesses.
|
55
55
|
def scan_templates
|
56
|
-
|
56
|
+
@templates = Dir.glob(File.join(path, "*")).inject([]) do |list, file_path|
|
57
57
|
log.debug "Checking if #{file_path} is a recognised template file."
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
if File.file?(file_path)
|
59
|
+
file_name = File.basename(file_path)
|
60
|
+
log.debug "#{file_path} is a template file." if !(Tilt[file_name]).nil?
|
61
|
+
list << file_path if !(Tilt[file_name]).nil?
|
62
|
+
end
|
61
63
|
list
|
62
|
-
|
64
|
+
end
|
63
65
|
end
|
64
66
|
end
|
65
67
|
end
|
File without changes
|
@@ -8,6 +8,14 @@ describe TemplateMailer::TemplateDirectory do
|
|
8
8
|
TemplateMailer::TemplateDirectory.new(path)
|
9
9
|
}
|
10
10
|
|
11
|
+
describe "construction" do
|
12
|
+
it "doesn't get trip up by directories that have names matching template types" do
|
13
|
+
expect {
|
14
|
+
TemplateMailer::TemplateDirectory.new(File.join(path, "dir_name_check"))
|
15
|
+
}.not_to raise_error
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
11
19
|
describe "#path()" do
|
12
20
|
it "returns the path to the template directory" do
|
13
21
|
expect(subject.path).to eq(path)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: template_mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Wood
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- lib/template_mailer/template_directory.rb
|
104
104
|
- lib/template_mailer/template_factory.rb
|
105
105
|
- lib/template_mailer/version.rb
|
106
|
+
- spec/data/dir_name_check/ls/do_not_delete
|
106
107
|
- spec/data/more_templates/another_template.text.erb
|
107
108
|
- spec/data/test_template_1.txt
|
108
109
|
- spec/data/test_template_2.txt.erb
|
@@ -120,7 +121,7 @@ homepage: https://github.com/free-beer/template_mailer
|
|
120
121
|
licenses:
|
121
122
|
- MIT
|
122
123
|
metadata: {}
|
123
|
-
post_install_message:
|
124
|
+
post_install_message:
|
124
125
|
rdoc_options: []
|
125
126
|
require_paths:
|
126
127
|
- lib
|
@@ -135,12 +136,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
136
|
- !ruby/object:Gem::Version
|
136
137
|
version: '0'
|
137
138
|
requirements: []
|
138
|
-
rubygems_version: 3.0.
|
139
|
-
signing_key:
|
139
|
+
rubygems_version: 3.0.8
|
140
|
+
signing_key:
|
140
141
|
specification_version: 4
|
141
142
|
summary: A simple library that uses the Tilt and Pony libraries to generate and dispatch
|
142
143
|
emails.
|
143
144
|
test_files:
|
145
|
+
- spec/data/dir_name_check/ls/do_not_delete
|
144
146
|
- spec/data/more_templates/another_template.text.erb
|
145
147
|
- spec/data/test_template_1.txt
|
146
148
|
- spec/data/test_template_2.txt.erb
|