whitelist_mail_proxy 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -45,7 +45,7 @@ spec = Gem::Specification.new do |s|
45
45
 
46
46
  # Change these as appropriate
47
47
  s.name = "whitelist_mail_proxy"
48
- s.version = "0.1.0"
48
+ s.version = "0.2.0"
49
49
  s.summary = "A thin proxy for Mail and ActionMailer to enable whitelisting"
50
50
  s.author = "Matthew Rudy Jacobs"
51
51
  s.email = "MatthewRudyJacobs@gmail.com"
@@ -3,6 +3,9 @@ class WhitelistMailProxy
3
3
  def initialize(options)
4
4
  @delivery_method = options[:delivery_method]
5
5
  @regexp = options[:regexp]
6
+
7
+ raise "must have :delivery_method" unless @delivery_method
8
+ raise "must have :regexp" unless @regexp
6
9
  end
7
10
  attr_reader :delivery_method, :regexp
8
11
 
@@ -16,10 +19,14 @@ class WhitelistMailProxy
16
19
  end
17
20
 
18
21
  if blocked.any?
19
- raise "cannot send to #{blocked.inspect}"
22
+ raise "cannot send to #{blocked.inspect}, whitelist is #{regexp.inspect}"
20
23
  else
21
24
  delivery_method.deliver!(mail)
22
25
  end
23
26
  end
24
27
 
25
28
  end
29
+
30
+ if defined?(Rails)
31
+ require 'whitelist_mail_proxy/railtie'
32
+ end
@@ -0,0 +1,8 @@
1
+ require 'rails'
2
+ class WhitelistMailProxy
3
+ class Railtie < Rails::Railtie
4
+ initializer "actionmailer.whitelist" do
5
+ ActionMailer::Base.add_delivery_method(:whitelist_proxy, WhitelistMailProxy)
6
+ end
7
+ end
8
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whitelist_mail_proxy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matthew Rudy Jacobs
@@ -31,6 +31,7 @@ files:
31
31
  - MIT-LICENSE
32
32
  - Rakefile
33
33
  - README
34
+ - lib/whitelist_mail_proxy/railtie.rb
34
35
  - lib/whitelist_mail_proxy.rb
35
36
  has_rdoc: true
36
37
  homepage: http://github.com/matthewrudy/whitelist-mail-proxy