mail_envi 0.1.2 → 0.2.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.
- data/README.md +5 -7
- data/VERSION +1 -1
- data/lib/mail_envi/config.rb +12 -2
- data/lib/mail_envi.rb +1 -4
- data/mail_envi.gemspec +2 -2
- data/test/dummy/config/initializers/mail_envi.rb +1 -1
- data/test/mail_envi/test_config.rb +3 -3
- data/test/test_mail_envi.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# MailEnvi
|
1
|
+
# MailEnvi
|
2
2
|
|
3
|
-
A basic Mail interceptor gem for (Rails 3) development
|
3
|
+
A basic Mail interceptor gem for (Rails 3) development and other environments.
|
4
4
|
|
5
5
|
### Basic Usage
|
6
6
|
|
@@ -10,12 +10,10 @@ A basic Mail interceptor gem for (Rails 3) development/test and other environmen
|
|
10
10
|
|
11
11
|
That is about it.
|
12
12
|
|
13
|
-
group :development do
|
14
|
-
gem "mail_envi"
|
15
|
-
end
|
16
|
-
|
17
13
|
While, you can configure the MailEnvi to work within any environment. For most basic uses, I recommend you keep this gem under your `development` group in your `Gemfile`.
|
18
14
|
|
15
|
+
---
|
16
|
+
|
19
17
|
Intercepted mail will, by default, change the `to` address to `root@localhost` and will prefix the subject to identify it was intercepted.
|
20
18
|
|
21
19
|
Ex:
|
@@ -36,7 +34,7 @@ There are a few configuration options you can provide to extend/customize the fu
|
|
36
34
|
|
37
35
|
In your `initializer/mail_envi.rb`
|
38
36
|
|
39
|
-
MailEnvi.
|
37
|
+
MailEnvi::Config.set do |config|
|
40
38
|
config.interceptor = CustomInterceptorClass
|
41
39
|
config.default_to = "person@company.com"
|
42
40
|
config.include_environments [:beta, :alpha]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/mail_envi/config.rb
CHANGED
@@ -1,12 +1,22 @@
|
|
1
1
|
module MailEnvi
|
2
2
|
class Config
|
3
|
+
class << self
|
4
|
+
def instance
|
5
|
+
@instance
|
6
|
+
end
|
7
|
+
|
8
|
+
def set(&block)
|
9
|
+
@instance = new(&block)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
3
13
|
def initialize &block
|
4
14
|
@environments = ['development']
|
5
|
-
|
6
15
|
instance_eval(&block) if block_given?
|
7
16
|
end
|
8
17
|
|
9
|
-
attr_accessor :interceptor, :
|
18
|
+
attr_accessor :interceptor, :default_to
|
19
|
+
attr_reader :environments
|
10
20
|
|
11
21
|
def interceptor
|
12
22
|
@interceptor || MailEnvi::DefaultInterceptor
|
data/lib/mail_envi.rb
CHANGED
@@ -3,8 +3,6 @@ require 'mail'
|
|
3
3
|
require 'mail_envi/config'
|
4
4
|
|
5
5
|
module MailEnvi
|
6
|
-
@config = nil
|
7
|
-
|
8
6
|
module Rails
|
9
7
|
class Railtie < ::Rails::Railtie
|
10
8
|
config.after_initialize do
|
@@ -21,8 +19,7 @@ module MailEnvi
|
|
21
19
|
end
|
22
20
|
|
23
21
|
def self.config &block
|
24
|
-
|
25
|
-
@config || MailEnvi::Config.new
|
22
|
+
@@config ||= MailEnvi::Config.instance
|
26
23
|
end
|
27
24
|
|
28
25
|
|
data/mail_envi.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{mail_envi}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = [%q{Yung Hwa Kwon}]
|
12
|
-
s.date = %q{2011-09-
|
12
|
+
s.date = %q{2011-09-15}
|
13
13
|
s.description = %q{}
|
14
14
|
s.email = %q{yung.kwon@damncarousel.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -22,7 +22,7 @@ class TestConfig < ActiveSupport::TestCase
|
|
22
22
|
end
|
23
23
|
|
24
24
|
should "allow the interceptor to be assigned to a custom class" do
|
25
|
-
MailEnvi.
|
25
|
+
MailEnvi::Config.set do |config|
|
26
26
|
config.interceptor = CustomInterceptor
|
27
27
|
end
|
28
28
|
|
@@ -30,7 +30,7 @@ class TestConfig < ActiveSupport::TestCase
|
|
30
30
|
end
|
31
31
|
|
32
32
|
should "allow additional environments to be included" do
|
33
|
-
MailEnvi.
|
33
|
+
MailEnvi::Config.set do |config|
|
34
34
|
config.include_environments [:test, :staging, 'beta']
|
35
35
|
end
|
36
36
|
|
@@ -39,7 +39,7 @@ class TestConfig < ActiveSupport::TestCase
|
|
39
39
|
end
|
40
40
|
|
41
41
|
should "allow the defaults in the default interceptor to be overwritten" do
|
42
|
-
MailEnvi.
|
42
|
+
MailEnvi::Config.set do |config|
|
43
43
|
config.default_to = "another@company.com"
|
44
44
|
end
|
45
45
|
|
data/test/test_mail_envi.rb
CHANGED
@@ -28,7 +28,7 @@ class TestMailEnvi < ActiveSupport::TestCase
|
|
28
28
|
|
29
29
|
context "in a development or included environments" do
|
30
30
|
should "register the default Mail interceptor" do
|
31
|
-
mail_envi_config = MailEnvi.
|
31
|
+
mail_envi_config = MailEnvi::Config.set do |config|
|
32
32
|
config.include_environments [:test, :staging, :beta]
|
33
33
|
end
|
34
34
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: mail_envi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.2.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Yung Hwa Kwon
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-09-
|
13
|
+
date: 2011-09-15 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -163,7 +163,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
163
163
|
requirements:
|
164
164
|
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
hash: -
|
166
|
+
hash: -1117488473485873375
|
167
167
|
segments:
|
168
168
|
- 0
|
169
169
|
version: "0"
|