action_mailer_config 2.1.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 +7 -0
- data/.cleancode +4 -0
- data/.document +5 -0
- data/.gitignore +48 -0
- data/.rspec +1 -0
- data/.rubocop.yml +123 -0
- data/CHANGELOG.md +32 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +117 -0
- data/LICENSE.txt +22 -0
- data/README.md +67 -0
- data/Rakefile +1 -0
- data/action_mailer_config.gemspec +28 -0
- data/lib/action_mailer_config.rb +42 -0
- data/lib/action_mailer_config/rails.rb +20 -0
- data/lib/action_mailer_config/version.rb +3 -0
- data/spec/action_mailer_config_spec.rb +102 -0
- data/spec/spec_helper.rb +12 -0
- metadata +160 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a008ad6c5c5a434d6e5c876c7027e6a89f61f3de7c598dabd98c923e7ed53b6e
|
4
|
+
data.tar.gz: f4cb916ad5f90360380da9879011f611ce4e42c798ca52d3e7704a94c0525e57
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3ce1d62ad09b97cabe6b2df29f01bed8ec7c0ed1b2e053ff2940ea205918b27abd561bb78c3abe5c43eb811bccbaec1434924485be884e55329ea5c251b73ada
|
7
|
+
data.tar.gz: b6917485462171f2efbf47fe32aa7699e00bef61707beae60f8b3d20a6d58aa62d7efac8975a434347bf16957f9ca9f3246d5320911245ab371aeae183cb0fed
|
data/.cleancode
ADDED
data/.document
ADDED
data/.gitignore
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# rcov generated
|
2
|
+
coverage
|
3
|
+
|
4
|
+
# rdoc generated
|
5
|
+
rdoc
|
6
|
+
|
7
|
+
# yard generated
|
8
|
+
doc
|
9
|
+
.yardoc
|
10
|
+
|
11
|
+
# bundler
|
12
|
+
.bundle
|
13
|
+
|
14
|
+
# jeweler generated
|
15
|
+
pkg
|
16
|
+
|
17
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
18
|
+
#
|
19
|
+
# * Create a file at ~/.gitignore
|
20
|
+
# * Include files you want ignored
|
21
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
22
|
+
#
|
23
|
+
# After doing this, these files will be ignored in all your git projects,
|
24
|
+
# saving you from having to 'pollute' every project you touch with them
|
25
|
+
#
|
26
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
27
|
+
#
|
28
|
+
# For MacOS:
|
29
|
+
#
|
30
|
+
#.DS_Store
|
31
|
+
|
32
|
+
# For TextMate
|
33
|
+
#*.tmproj
|
34
|
+
#tmtags
|
35
|
+
|
36
|
+
# For emacs:
|
37
|
+
#*~
|
38
|
+
#\#*
|
39
|
+
#.\#*
|
40
|
+
|
41
|
+
# For vim:
|
42
|
+
#*.swp
|
43
|
+
|
44
|
+
# For redcar:
|
45
|
+
#.redcar
|
46
|
+
|
47
|
+
# For rubinius:
|
48
|
+
#*.rbc
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- bin/*
|
4
|
+
- node_modules/**/*
|
5
|
+
|
6
|
+
Layout/CaseIndentation:
|
7
|
+
EnforcedStyle: end
|
8
|
+
|
9
|
+
Layout/EndAlignment:
|
10
|
+
EnforcedStyleAlignWith: variable
|
11
|
+
|
12
|
+
Layout/EmptyLinesAroundAccessModifier:
|
13
|
+
EnforcedStyle: only_before
|
14
|
+
|
15
|
+
Layout/SpaceInLambdaLiteral:
|
16
|
+
EnforcedStyle: require_space
|
17
|
+
|
18
|
+
Layout/SpaceInsideBlockBraces:
|
19
|
+
SpaceBeforeBlockParameters: false
|
20
|
+
|
21
|
+
Layout/SpaceInsideHashLiteralBraces:
|
22
|
+
EnforcedStyle: no_space
|
23
|
+
|
24
|
+
Metrics/AbcSize:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Metrics/BlockLength:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
Metrics/ClassLength:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
Metrics/CyclomaticComplexity:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
Metrics/LineLength:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
Metrics/MethodLength:
|
40
|
+
Enabled: false
|
41
|
+
|
42
|
+
Metrics/ModuleLength:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
Metrics/PerceivedComplexity:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Naming/HeredocDelimiterNaming:
|
49
|
+
Enabled: false
|
50
|
+
|
51
|
+
Naming/PredicateName:
|
52
|
+
Enabled: false
|
53
|
+
|
54
|
+
Naming/UncommunicativeMethodParamName:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
Style/Alias:
|
58
|
+
EnforcedStyle: prefer_alias_method
|
59
|
+
|
60
|
+
Style/AsciiComments:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
Style/BlockDelimiters:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
Style/Documentation:
|
67
|
+
Enabled: false
|
68
|
+
|
69
|
+
Style/EmptyCaseCondition:
|
70
|
+
Enabled: false
|
71
|
+
|
72
|
+
Style/EmptyMethod:
|
73
|
+
EnforcedStyle: expanded
|
74
|
+
|
75
|
+
Style/FrozenStringLiteralComment:
|
76
|
+
Enabled: false
|
77
|
+
|
78
|
+
Style/HashSyntax:
|
79
|
+
Exclude:
|
80
|
+
- Rakefile
|
81
|
+
- "**/*.rake"
|
82
|
+
|
83
|
+
Style/Lambda:
|
84
|
+
EnforcedStyle: literal
|
85
|
+
|
86
|
+
Style/IfUnlessModifier:
|
87
|
+
Enabled: false
|
88
|
+
|
89
|
+
Style/MultilineBlockChain:
|
90
|
+
Enabled: false
|
91
|
+
|
92
|
+
Style/NumericLiterals:
|
93
|
+
Enabled: false
|
94
|
+
|
95
|
+
Style/NumericPredicate:
|
96
|
+
Enabled: false
|
97
|
+
|
98
|
+
Style/PercentLiteralDelimiters:
|
99
|
+
PreferredDelimiters:
|
100
|
+
'%i': '()'
|
101
|
+
'%w': '()'
|
102
|
+
'%r': '()'
|
103
|
+
|
104
|
+
Style/SpecialGlobalVars:
|
105
|
+
Enabled: false
|
106
|
+
|
107
|
+
Style/StringLiterals:
|
108
|
+
EnforcedStyle: double_quotes
|
109
|
+
|
110
|
+
Style/StringLiteralsInInterpolation:
|
111
|
+
EnforcedStyle: double_quotes
|
112
|
+
|
113
|
+
Style/TrailingCommaInArguments:
|
114
|
+
EnforcedStyleForMultiline: consistent_comma
|
115
|
+
|
116
|
+
Style/TrailingCommaInArrayLiteral:
|
117
|
+
EnforcedStyleForMultiline: consistent_comma
|
118
|
+
|
119
|
+
Style/TrailingCommaInHashLiteral:
|
120
|
+
EnforcedStyleForMultiline: consistent_comma
|
121
|
+
|
122
|
+
Style/ZeroLengthPredicate:
|
123
|
+
Enabled: false
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# v2.1.0
|
2
|
+
|
3
|
+
- Support `default` settings to set `ActionMailer::Base.default`.
|
4
|
+
|
5
|
+
# v2.0.1
|
6
|
+
|
7
|
+
- Use `Rails.application.config.action_mailer` if available (to support `default_url_options` on v2).
|
8
|
+
|
9
|
+
# v2.0.0
|
10
|
+
|
11
|
+
- Change configuration syntax.
|
12
|
+
|
13
|
+
# v1.0.5
|
14
|
+
|
15
|
+
- Symbolize `default_url_options` keys.
|
16
|
+
|
17
|
+
# v1.0.4
|
18
|
+
|
19
|
+
- Support `default_url_options`.
|
20
|
+
|
21
|
+
# v1.0.3
|
22
|
+
|
23
|
+
- Support `letter_opener`.
|
24
|
+
|
25
|
+
# v1.0.2
|
26
|
+
|
27
|
+
- Support `actionmailer` 4.
|
28
|
+
- Remove dependency from `jeweler`.
|
29
|
+
|
30
|
+
# v1.0.1
|
31
|
+
|
32
|
+
- Initial release.
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
action_mailer_config (2.1.0)
|
5
|
+
actionmailer (>= 3)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionmailer (6.0.0)
|
11
|
+
actionpack (= 6.0.0)
|
12
|
+
actionview (= 6.0.0)
|
13
|
+
activejob (= 6.0.0)
|
14
|
+
mail (~> 2.5, >= 2.5.4)
|
15
|
+
rails-dom-testing (~> 2.0)
|
16
|
+
actionpack (6.0.0)
|
17
|
+
actionview (= 6.0.0)
|
18
|
+
activesupport (= 6.0.0)
|
19
|
+
rack (~> 2.0)
|
20
|
+
rack-test (>= 0.6.3)
|
21
|
+
rails-dom-testing (~> 2.0)
|
22
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
23
|
+
actionview (6.0.0)
|
24
|
+
activesupport (= 6.0.0)
|
25
|
+
builder (~> 3.1)
|
26
|
+
erubi (~> 1.4)
|
27
|
+
rails-dom-testing (~> 2.0)
|
28
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
29
|
+
activejob (6.0.0)
|
30
|
+
activesupport (= 6.0.0)
|
31
|
+
globalid (>= 0.3.6)
|
32
|
+
activesupport (6.0.0)
|
33
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
34
|
+
i18n (>= 0.7, < 2)
|
35
|
+
minitest (~> 5.1)
|
36
|
+
tzinfo (~> 1.1)
|
37
|
+
zeitwerk (~> 2.1, >= 2.1.8)
|
38
|
+
addressable (2.6.0)
|
39
|
+
public_suffix (>= 2.0.2, < 4.0)
|
40
|
+
ast (2.4.0)
|
41
|
+
builder (3.2.3)
|
42
|
+
concurrent-ruby (1.1.5)
|
43
|
+
crass (1.0.5)
|
44
|
+
diff-lcs (1.3)
|
45
|
+
erubi (1.8.0)
|
46
|
+
globalid (0.4.2)
|
47
|
+
activesupport (>= 4.2.0)
|
48
|
+
i18n (1.6.0)
|
49
|
+
concurrent-ruby (~> 1.0)
|
50
|
+
jaro_winkler (1.5.3)
|
51
|
+
launchy (2.4.3)
|
52
|
+
addressable (~> 2.3)
|
53
|
+
letter_opener (1.7.0)
|
54
|
+
launchy (~> 2.2)
|
55
|
+
loofah (2.3.1)
|
56
|
+
crass (~> 1.0.2)
|
57
|
+
nokogiri (>= 1.5.9)
|
58
|
+
mail (2.7.1)
|
59
|
+
mini_mime (>= 0.1.1)
|
60
|
+
mini_mime (1.0.2)
|
61
|
+
mini_portile2 (2.4.0)
|
62
|
+
minitest (5.11.3)
|
63
|
+
nokogiri (1.10.8)
|
64
|
+
mini_portile2 (~> 2.4.0)
|
65
|
+
parallel (1.17.0)
|
66
|
+
parser (2.6.3.0)
|
67
|
+
ast (~> 2.4.0)
|
68
|
+
public_suffix (3.1.1)
|
69
|
+
rack (2.0.8)
|
70
|
+
rack-test (1.1.0)
|
71
|
+
rack (>= 1.0, < 3)
|
72
|
+
rails-dom-testing (2.0.3)
|
73
|
+
activesupport (>= 4.2.0)
|
74
|
+
nokogiri (>= 1.6)
|
75
|
+
rails-html-sanitizer (1.2.0)
|
76
|
+
loofah (~> 2.2, >= 2.2.2)
|
77
|
+
rainbow (3.0.0)
|
78
|
+
rake (12.3.3)
|
79
|
+
rspec (2.99.0)
|
80
|
+
rspec-core (~> 2.99.0)
|
81
|
+
rspec-expectations (~> 2.99.0)
|
82
|
+
rspec-mocks (~> 2.99.0)
|
83
|
+
rspec-core (2.99.2)
|
84
|
+
rspec-expectations (2.99.2)
|
85
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
86
|
+
rspec-its (1.0.1)
|
87
|
+
rspec-core (>= 2.99.0.beta1)
|
88
|
+
rspec-expectations (>= 2.99.0.beta1)
|
89
|
+
rspec-mocks (2.99.4)
|
90
|
+
rubocop (0.74.0)
|
91
|
+
jaro_winkler (~> 1.5.1)
|
92
|
+
parallel (~> 1.10)
|
93
|
+
parser (>= 2.6)
|
94
|
+
rainbow (>= 2.2.2, < 4.0)
|
95
|
+
ruby-progressbar (~> 1.7)
|
96
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
97
|
+
ruby-progressbar (1.10.1)
|
98
|
+
thread_safe (0.3.6)
|
99
|
+
tzinfo (1.2.5)
|
100
|
+
thread_safe (~> 0.1)
|
101
|
+
unicode-display_width (1.6.0)
|
102
|
+
zeitwerk (2.1.9)
|
103
|
+
|
104
|
+
PLATFORMS
|
105
|
+
ruby
|
106
|
+
|
107
|
+
DEPENDENCIES
|
108
|
+
action_mailer_config!
|
109
|
+
bundler (~> 1.5)
|
110
|
+
letter_opener
|
111
|
+
rake
|
112
|
+
rspec (~> 2.10)
|
113
|
+
rspec-its
|
114
|
+
rubocop
|
115
|
+
|
116
|
+
BUNDLED WITH
|
117
|
+
2.1.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 labocho
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# action_mailer_config
|
2
|
+
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
|
6
|
+
Add this line to your application's Gemfile:
|
7
|
+
|
8
|
+
gem 'action_mailer_config', '~> 2.0'
|
9
|
+
|
10
|
+
And then execute:
|
11
|
+
|
12
|
+
$ bundle
|
13
|
+
|
14
|
+
Or install it yourself as:
|
15
|
+
|
16
|
+
$ gem install action_mailer_config
|
17
|
+
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
require "action_mailer_config"
|
22
|
+
ActionMailerConfig.load(
|
23
|
+
delivery_method: "smtp",
|
24
|
+
smtp_settings: {
|
25
|
+
port: 1234,
|
26
|
+
},
|
27
|
+
default: {
|
28
|
+
from: "from@example.com",
|
29
|
+
},
|
30
|
+
)
|
31
|
+
|
32
|
+
for Rails, please make config/mail.yml like below.
|
33
|
+
|
34
|
+
development:
|
35
|
+
delivery_method: letter_opener
|
36
|
+
|
37
|
+
test:
|
38
|
+
delivery_method: test
|
39
|
+
|
40
|
+
production:
|
41
|
+
delivery_method: smtp
|
42
|
+
smtp_settings:
|
43
|
+
address: mail.example.com
|
44
|
+
user_name: noreply@example.com
|
45
|
+
password: xxxxxx
|
46
|
+
default:
|
47
|
+
from: from@example.com
|
48
|
+
|
49
|
+
and add `require "action_mailer_config/rails"` to config/application.rb.
|
50
|
+
|
51
|
+
# config/initializer/application.rb
|
52
|
+
module YourApplication
|
53
|
+
class Application < Rails::Application
|
54
|
+
# ...
|
55
|
+
require "action_mailer_config/rails"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
## Contributing
|
61
|
+
|
62
|
+
1. Fork it ( http://github.com/labocho/action_mailer_config/fork )
|
63
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
64
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
65
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
66
|
+
5. Create new Pull Request
|
67
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,28 @@
|
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "action_mailer_config/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "action_mailer_config"
|
7
|
+
spec.version = ActionMailerConfig::VERSION
|
8
|
+
spec.authors = ["labocho"]
|
9
|
+
spec.email = ["labocho@penguinlab.jp"]
|
10
|
+
spec.summary = "Load ActionMailer configuration from YAML"
|
11
|
+
spec.description = "Load ActionMailer configuration from YAML"
|
12
|
+
spec.homepage = "https://github.com/labocho/action_mailer_config"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r(^bin/)) {|f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_runtime_dependency "actionmailer", ">= 3"
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
23
|
+
spec.add_development_dependency "letter_opener"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
spec.add_development_dependency "rspec", "~> 2.10"
|
26
|
+
spec.add_development_dependency "rspec-its"
|
27
|
+
spec.add_development_dependency "rubocop"
|
28
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require "action_mailer_config/version"
|
2
|
+
require "action_mailer"
|
3
|
+
|
4
|
+
module ActionMailerConfig
|
5
|
+
module_function
|
6
|
+
def load(config)
|
7
|
+
config = symbolize_keys(config)
|
8
|
+
delivery_method = (config.delete(:delivery_method) || :test).to_sym
|
9
|
+
|
10
|
+
if (default = config.delete(:default))
|
11
|
+
ActionMailer::Base.default(default)
|
12
|
+
end
|
13
|
+
|
14
|
+
if defined?(Rails)
|
15
|
+
Rails.application.config.action_mailer.delivery_method = delivery_method
|
16
|
+
config.each do |attribute, value|
|
17
|
+
Rails.application.config.action_mailer.send("#{attribute}=", value)
|
18
|
+
end
|
19
|
+
else
|
20
|
+
ActionMailer::Base.instance_eval do
|
21
|
+
self.delivery_method = delivery_method
|
22
|
+
config.each do |attribute, value|
|
23
|
+
send("#{attribute}=", value)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# for actionmailer 4
|
30
|
+
def symbolize_keys(obj)
|
31
|
+
case obj
|
32
|
+
when Hash
|
33
|
+
obj.each_with_object({}) do |(k, v), h|
|
34
|
+
h[k.to_sym] = symbolize_keys(v)
|
35
|
+
end
|
36
|
+
when Array
|
37
|
+
obj.map {|e| symbolize_keys(e) }
|
38
|
+
else
|
39
|
+
obj
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "action_mailer_config"
|
2
|
+
require "yaml"
|
3
|
+
|
4
|
+
path = "#{Rails.root}/config/mail.yml"
|
5
|
+
|
6
|
+
config = if File.exist? path
|
7
|
+
config_for_all = YAML.load_file(path)
|
8
|
+
|
9
|
+
if config_for_all.key? Rails.env
|
10
|
+
config_for_all[Rails.env]
|
11
|
+
else
|
12
|
+
warn "Could not found ActionMailer config for #{Rails.env.inspect}, use delivery_method: test"
|
13
|
+
{}
|
14
|
+
end
|
15
|
+
else
|
16
|
+
warn "Could not found ActionMailer config file: #{path}, use delivery_method: test"
|
17
|
+
{}
|
18
|
+
end
|
19
|
+
|
20
|
+
ActionMailerConfig.load config
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
|
2
|
+
|
3
|
+
describe ActionMailerConfig do
|
4
|
+
subject { ActionMailer::Base }
|
5
|
+
|
6
|
+
describe ".load" do
|
7
|
+
context "delivery_method: test" do
|
8
|
+
before do
|
9
|
+
ActionMailerConfig.load(
|
10
|
+
"delivery_method" => "test",
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
its(:delivery_method) { should == :test }
|
15
|
+
end
|
16
|
+
|
17
|
+
context "delivery_method: smtp" do
|
18
|
+
before do
|
19
|
+
ActionMailerConfig.load(
|
20
|
+
"delivery_method" => "smtp",
|
21
|
+
"smtp_settings" => {
|
22
|
+
"port" => 1234,
|
23
|
+
"address" => "mail.example.com",
|
24
|
+
"some_setting" => "some value",
|
25
|
+
},
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
its(:delivery_method) { should == :smtp }
|
30
|
+
its(:smtp_settings) {
|
31
|
+
should == {port: 1234, address: "mail.example.com", some_setting: "some value"}
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
context "delivery_method: sendmail" do
|
36
|
+
before do
|
37
|
+
ActionMailerConfig.load(
|
38
|
+
"delivery_method" => "sendmail",
|
39
|
+
"sendmail_settings" => {
|
40
|
+
"location" => "/path/to/sendmail",
|
41
|
+
"arguments" => "--some-arguments",
|
42
|
+
},
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
its(:delivery_method) { should == :sendmail }
|
47
|
+
its(:sendmail_settings) {
|
48
|
+
should == {location: "/path/to/sendmail", arguments: "--some-arguments"}
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
context "delivery_method: letter_opener" do
|
53
|
+
before do
|
54
|
+
ActionMailerConfig.load(
|
55
|
+
"delivery_method" => "letter_opener",
|
56
|
+
)
|
57
|
+
end
|
58
|
+
|
59
|
+
its(:delivery_method) { should == :letter_opener }
|
60
|
+
end
|
61
|
+
|
62
|
+
context "delivery_method: mailcatcher" do
|
63
|
+
before do
|
64
|
+
ActionMailerConfig.load(
|
65
|
+
"delivery_method" => "mailcatcher",
|
66
|
+
)
|
67
|
+
end
|
68
|
+
|
69
|
+
its(:delivery_method) { should == :mailcatcher }
|
70
|
+
|
71
|
+
context "override default port" do
|
72
|
+
before do
|
73
|
+
ActionMailerConfig.load(
|
74
|
+
"delivery_method" => "mailcatcher",
|
75
|
+
"smtp_settings" => {
|
76
|
+
"port" => 1234,
|
77
|
+
},
|
78
|
+
)
|
79
|
+
end
|
80
|
+
|
81
|
+
its(:smtp_settings) {
|
82
|
+
should == {port: 1234}
|
83
|
+
}
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
context "set default" do
|
88
|
+
before do
|
89
|
+
ActionMailerConfig.load(
|
90
|
+
"delivery_method" => "test",
|
91
|
+
"default" => {
|
92
|
+
"from" => "from@example.com",
|
93
|
+
},
|
94
|
+
)
|
95
|
+
end
|
96
|
+
|
97
|
+
it "sets default value" do
|
98
|
+
expect(ActionMailer::Base.default[:from]).to eq "from@example.com"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require "rspec"
|
4
|
+
require "rspec/its"
|
5
|
+
require "action_mailer_config"
|
6
|
+
|
7
|
+
# Requires supporting files with custom matchers and macros, etc,
|
8
|
+
# in ./support/ and its subdirectories.
|
9
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f }
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: action_mailer_config
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- labocho
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-03-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: actionmailer
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.5'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: letter_opener
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.10'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.10'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec-its
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Load ActionMailer configuration from YAML
|
112
|
+
email:
|
113
|
+
- labocho@penguinlab.jp
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".cleancode"
|
119
|
+
- ".document"
|
120
|
+
- ".gitignore"
|
121
|
+
- ".rspec"
|
122
|
+
- ".rubocop.yml"
|
123
|
+
- CHANGELOG.md
|
124
|
+
- Gemfile
|
125
|
+
- Gemfile.lock
|
126
|
+
- LICENSE.txt
|
127
|
+
- README.md
|
128
|
+
- Rakefile
|
129
|
+
- action_mailer_config.gemspec
|
130
|
+
- lib/action_mailer_config.rb
|
131
|
+
- lib/action_mailer_config/rails.rb
|
132
|
+
- lib/action_mailer_config/version.rb
|
133
|
+
- spec/action_mailer_config_spec.rb
|
134
|
+
- spec/spec_helper.rb
|
135
|
+
homepage: https://github.com/labocho/action_mailer_config
|
136
|
+
licenses:
|
137
|
+
- MIT
|
138
|
+
metadata: {}
|
139
|
+
post_install_message:
|
140
|
+
rdoc_options: []
|
141
|
+
require_paths:
|
142
|
+
- lib
|
143
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
requirements: []
|
154
|
+
rubygems_version: 3.1.2
|
155
|
+
signing_key:
|
156
|
+
specification_version: 4
|
157
|
+
summary: Load ActionMailer configuration from YAML
|
158
|
+
test_files:
|
159
|
+
- spec/action_mailer_config_spec.rb
|
160
|
+
- spec/spec_helper.rb
|