maildotyml 0.0.2 → 0.0.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.
- data/README.md +16 -4
- data/lib/maildotyml/configuration.rb +12 -1
- data/lib/maildotyml/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -35,22 +35,34 @@ test:
|
|
35
35
|
|
36
36
|
production:
|
37
37
|
adapter: :smtp
|
38
|
-
|
38
|
+
# Note that some standard activerecord options are automatically translated.
|
39
|
+
host: 'your.smtp.server'
|
39
40
|
port: 25
|
40
41
|
authentication: 'login'
|
41
42
|
domain: 'your.domain-to.authenticate-to.smtp.com'
|
42
|
-
|
43
|
+
username: <%= ENV['MAIL_USERNAME'] %>
|
43
44
|
password: <%= ENV['MAIL_PASSWORD'] %>
|
44
45
|
enable_startttls_auto: true
|
45
46
|
```
|
46
47
|
|
48
|
+
### ActiveRecord style keys
|
49
|
+
|
50
|
+
In order to be more like ActiveRecord configuration, maildotyml automatically
|
51
|
+
maps some configuration keys. For example, ActiveRecord expects a `username` for
|
52
|
+
database connection. ActionMailer expects `user_name` for smtp configuration.
|
53
|
+
|
54
|
+
With maildotyml, either will work.
|
55
|
+
|
56
|
+
#### Supported mappings
|
57
|
+
|
58
|
+
* `username` -> `user_name`
|
59
|
+
* `host` -> `address`
|
60
|
+
|
47
61
|
## TODO
|
48
62
|
|
49
63
|
The following features are planned for the near future:
|
50
64
|
|
51
65
|
* Add a generator to create `config/mail.yml.example` with example configuration.
|
52
|
-
* Map common ActiveRecord configuration keys.
|
53
|
-
(ie, `username` -> `user_name`).
|
54
66
|
|
55
67
|
## Contributing
|
56
68
|
|
@@ -15,7 +15,7 @@ module Maildotyml
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def settings
|
18
|
-
parsed.reject { |k,v| k == :adapter }
|
18
|
+
map_activerecord_style_keys(parsed.reject { |k,v| k == :adapter })
|
19
19
|
end
|
20
20
|
|
21
21
|
def present?
|
@@ -37,5 +37,16 @@ module Maildotyml
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
+
def map_activerecord_style_keys(settings)
|
41
|
+
settings = settings.dup
|
42
|
+
replace_hash_key(settings, :username, :user_name)
|
43
|
+
replace_hash_key(settings, :host, :address)
|
44
|
+
|
45
|
+
settings
|
46
|
+
end
|
47
|
+
|
48
|
+
def replace_hash_key(hash, before, after)
|
49
|
+
hash[after] = hash.delete(before) if hash[before]
|
50
|
+
end
|
40
51
|
end
|
41
52
|
end
|
data/lib/maildotyml/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maildotyml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -88,7 +88,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
88
88
|
version: '0'
|
89
89
|
segments:
|
90
90
|
- 0
|
91
|
-
hash: -
|
91
|
+
hash: -1678483686810107958
|
92
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
93
|
none: false
|
94
94
|
requirements:
|
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
97
|
version: '0'
|
98
98
|
segments:
|
99
99
|
- 0
|
100
|
-
hash: -
|
100
|
+
hash: -1678483686810107958
|
101
101
|
requirements: []
|
102
102
|
rubyforge_project:
|
103
103
|
rubygems_version: 1.8.25
|