mail_envi 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # MailEnvi, :require => "mail_envi"
1
+ # MailEnvi
2
2
 
3
- A basic Mail interceptor gem for (Rails 3) development/test and other environments.
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.config do |config|
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.2
1
+ 0.2.0
@@ -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, :environments, :default_to
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
- @config = MailEnvi::Config.new &block if block_given?
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.1.2"
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-14}
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 = [
@@ -1,4 +1,4 @@
1
- MailEnvi.config do |config|
1
+ MailEnvi::Config.set do |config|
2
2
  config.include_environments ['test']
3
3
  config.default_to = "configured@company.com"
4
4
  end
@@ -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.config do |config|
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.config do |config|
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.config do |config|
42
+ MailEnvi::Config.set do |config|
43
43
  config.default_to = "another@company.com"
44
44
  end
45
45
 
@@ -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.config do |config|
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.1.2
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-14 00:00:00 Z
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: -4161991172690583465
166
+ hash: -1117488473485873375
167
167
  segments:
168
168
  - 0
169
169
  version: "0"