mail_safe 0.3.1 → 0.3.2
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/.gitignore +1 -1
- data/.travis.yml +9 -0
- data/Appraisals +11 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +97 -0
- data/LICENSE +4 -1
- data/{README.rdoc → README.md} +28 -16
- data/Rakefile +7 -45
- data/gemfiles/actionmailer_3_2.gemfile +7 -0
- data/gemfiles/actionmailer_4_0.gemfile +7 -0
- data/gemfiles/actionmailer_4_1.gemfile +7 -0
- data/lib/mail_safe.rb +2 -6
- data/lib/mail_safe/address_replacer.rb +11 -31
- data/lib/mail_safe/config.rb +3 -2
- data/lib/mail_safe/rails_hook.rb +11 -0
- data/lib/mail_safe/version.rb +3 -0
- data/mail_safe.gemspec +29 -61
- data/spec/config_spec.rb +22 -22
- data/spec/mailer_spec.rb +54 -23
- data/spec/mailers/test_mailer.rb +19 -27
- data/spec/spec_helper.rb +3 -6
- metadata +129 -80
- data/.document +0 -5
- data/VERSION.yml +0 -5
- data/autotest/discover.rb +0 -1
- data/ginger_scenarios.rb +0 -43
- data/lib/mail_safe/rails2_hook.rb +0 -16
- data/lib/mail_safe/rails3_hook.rb +0 -11
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 31c1a2b64eb57573f90a15add88b559edeec9b8e
|
|
4
|
+
data.tar.gz: 2f4bba2d1e5d7176d1b9882be77adc7bc94b89cc
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 5e05fe8957e4f3d977e23d7f714219bbd636d4fdd47349f63860d0cbabe96357fb0799119527720fdda9a0d7c37ca5a7b5c9a9c3e955edaad2ab67abdbe92f10
|
|
7
|
+
data.tar.gz: 63a8b3ab0f0ad45ec17f53417225097a4571915c192345da892ad5842d7ebd65c9d91eb7d0cf2686ce620e29e313f7b78c6018fe35179c3dcb39e551713f3f2b
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/Appraisals
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
mail_safe (0.3.2)
|
|
5
|
+
actionmailer (>= 3.0.0)
|
|
6
|
+
coveralls
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
actionmailer (4.1.5)
|
|
12
|
+
actionpack (= 4.1.5)
|
|
13
|
+
actionview (= 4.1.5)
|
|
14
|
+
mail (~> 2.5.4)
|
|
15
|
+
actionpack (4.1.5)
|
|
16
|
+
actionview (= 4.1.5)
|
|
17
|
+
activesupport (= 4.1.5)
|
|
18
|
+
rack (~> 1.5.2)
|
|
19
|
+
rack-test (~> 0.6.2)
|
|
20
|
+
actionview (4.1.5)
|
|
21
|
+
activesupport (= 4.1.5)
|
|
22
|
+
builder (~> 3.1)
|
|
23
|
+
erubis (~> 2.7.0)
|
|
24
|
+
activesupport (4.1.5)
|
|
25
|
+
i18n (~> 0.6, >= 0.6.9)
|
|
26
|
+
json (~> 1.7, >= 1.7.7)
|
|
27
|
+
minitest (~> 5.1)
|
|
28
|
+
thread_safe (~> 0.1)
|
|
29
|
+
tzinfo (~> 1.1)
|
|
30
|
+
appraisal (1.0.2)
|
|
31
|
+
bundler
|
|
32
|
+
rake
|
|
33
|
+
thor (>= 0.14.0)
|
|
34
|
+
builder (3.2.2)
|
|
35
|
+
coveralls (0.7.1)
|
|
36
|
+
multi_json (~> 1.3)
|
|
37
|
+
rest-client
|
|
38
|
+
simplecov (>= 0.7)
|
|
39
|
+
term-ansicolor
|
|
40
|
+
thor
|
|
41
|
+
diff-lcs (1.2.5)
|
|
42
|
+
docile (1.1.5)
|
|
43
|
+
erubis (2.7.0)
|
|
44
|
+
i18n (0.6.11)
|
|
45
|
+
json (1.8.1)
|
|
46
|
+
mail (2.5.4)
|
|
47
|
+
mime-types (~> 1.16)
|
|
48
|
+
treetop (~> 1.4.8)
|
|
49
|
+
mime-types (1.25.1)
|
|
50
|
+
minitest (5.4.1)
|
|
51
|
+
multi_json (1.10.1)
|
|
52
|
+
polyglot (0.3.5)
|
|
53
|
+
rack (1.5.2)
|
|
54
|
+
rack-test (0.6.2)
|
|
55
|
+
rack (>= 1.0)
|
|
56
|
+
rake (10.3.2)
|
|
57
|
+
rdoc (4.1.0)
|
|
58
|
+
rest-client (1.6.8)
|
|
59
|
+
mime-types (~> 1.16)
|
|
60
|
+
rdoc (>= 2.4.2)
|
|
61
|
+
rspec (3.0.0)
|
|
62
|
+
rspec-core (~> 3.0.0)
|
|
63
|
+
rspec-expectations (~> 3.0.0)
|
|
64
|
+
rspec-mocks (~> 3.0.0)
|
|
65
|
+
rspec-core (3.0.4)
|
|
66
|
+
rspec-support (~> 3.0.0)
|
|
67
|
+
rspec-expectations (3.0.4)
|
|
68
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
69
|
+
rspec-support (~> 3.0.0)
|
|
70
|
+
rspec-mocks (3.0.4)
|
|
71
|
+
rspec-support (~> 3.0.0)
|
|
72
|
+
rspec-support (3.0.4)
|
|
73
|
+
simplecov (0.9.0)
|
|
74
|
+
docile (~> 1.1.0)
|
|
75
|
+
multi_json
|
|
76
|
+
simplecov-html (~> 0.8.0)
|
|
77
|
+
simplecov-html (0.8.0)
|
|
78
|
+
term-ansicolor (1.3.0)
|
|
79
|
+
tins (~> 1.0)
|
|
80
|
+
thor (0.19.1)
|
|
81
|
+
thread_safe (0.3.4)
|
|
82
|
+
tins (1.3.2)
|
|
83
|
+
treetop (1.4.15)
|
|
84
|
+
polyglot
|
|
85
|
+
polyglot (>= 0.3.1)
|
|
86
|
+
tzinfo (1.2.2)
|
|
87
|
+
thread_safe (~> 0.1)
|
|
88
|
+
|
|
89
|
+
PLATFORMS
|
|
90
|
+
ruby
|
|
91
|
+
|
|
92
|
+
DEPENDENCIES
|
|
93
|
+
appraisal
|
|
94
|
+
bundler
|
|
95
|
+
mail_safe!
|
|
96
|
+
rake
|
|
97
|
+
rspec (~> 3.0, >= 3.0.0)
|
data/LICENSE
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
Copyright (c) 2009-2010 Myron Marston
|
|
1
|
+
Copyright (c) 2009-2010, Myron Marston, Kashless.org
|
|
2
|
+
Copyright (c) 2014, Watu
|
|
3
|
+
|
|
4
|
+
MIT License
|
|
2
5
|
|
|
3
6
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
7
|
a copy of this software and associated documentation files (the
|
data/{README.rdoc → README.md}
RENAMED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
[](https://travis-ci.org/watu/mail_safe)
|
|
2
|
+
[](https://coveralls.io/r/watu/mail_safe?branch=master)
|
|
3
|
+
[](https://codeclimate.com/github/watu/mail_safe)
|
|
4
|
+
[](http://inch-ci.org/github/watu/mail_safe)
|
|
5
|
+
[](http://badge.fury.io/rb/mail_safe)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# mail_safe
|
|
2
9
|
|
|
3
10
|
Mail safe provides a safety net while you're developing an application that uses ActionMailer.
|
|
4
11
|
It keeps emails from escaping into the wild.
|
|
@@ -8,41 +15,42 @@ emails to external email addresses. Instead, emails that would normally be deli
|
|
|
8
15
|
addresses will be sent to an address of your choosing, and the body of the email will be appended
|
|
9
16
|
with a note stating where the email was originally intended to go.
|
|
10
17
|
|
|
11
|
-
|
|
18
|
+
## Download
|
|
12
19
|
|
|
13
20
|
Github: http://github.com/myronmarston/mail_safe
|
|
14
21
|
|
|
15
|
-
Gem:
|
|
16
|
-
gem install mail_safe
|
|
22
|
+
Gem: `gem install mail_safe`
|
|
17
23
|
|
|
18
|
-
|
|
24
|
+
## Installation
|
|
19
25
|
|
|
20
|
-
Load the gem in the appropriate environments using Rails' 2
|
|
21
|
-
config/environments/development.rb and config/environments/staging.rb:
|
|
26
|
+
Load the gem in the appropriate environments using Rails' 3.2+ gem support. For example, I'm loading this in Gemfile as:
|
|
22
27
|
|
|
23
|
-
|
|
28
|
+
`gem "mail_safe", group: [:development, :staging]`
|
|
24
29
|
|
|
25
30
|
IMPORTANT: Be sure not to load this in your production environment, otherwise, your emails won't be sent to the proper
|
|
26
|
-
recipients.
|
|
31
|
+
recipients. In your test environment, you probably won't want this either. Rails ensures that no emails are ever sent in the
|
|
27
32
|
test environment, and tests that check outbound email recipients may fail.
|
|
28
33
|
|
|
29
|
-
|
|
34
|
+
## Configuration
|
|
30
35
|
|
|
31
36
|
In many cases, no configuration is necessary. If you have git installed, and you've registered your email address
|
|
32
37
|
with it (check with "git config user.email" in your shell), mail safe will use this. All emails will be sent to this address.
|
|
33
38
|
|
|
34
39
|
Otherwise, you can configure mail safe's behavior. Create a file at config/initializers/mail_safe.rb, similar to the following:
|
|
35
40
|
|
|
41
|
+
```ruby
|
|
36
42
|
if defined?(MailSafe::Config)
|
|
37
43
|
MailSafe::Config.internal_address_definition = /.*@my-domain\.com/i
|
|
38
44
|
MailSafe::Config.replacement_address = 'me@my-domain.com'
|
|
39
45
|
end
|
|
46
|
+
```
|
|
40
47
|
|
|
41
48
|
The internal address definition determines which addresses will be ignored (i.e. sent normally) and which will be replaced. Email
|
|
42
49
|
being sent to internal addresses will be sent normally; all other email addresses will be replaced by the replacement address.
|
|
43
50
|
|
|
44
51
|
These settings can also take procs if you need something more flexible:
|
|
45
52
|
|
|
53
|
+
```ruby
|
|
46
54
|
if defined?(MailSafe::Config)
|
|
47
55
|
MailSafe::Config.internal_address_definition = lambda { |address|
|
|
48
56
|
address =~ /.*@domain1\.com/i ||
|
|
@@ -53,9 +61,11 @@ These settings can also take procs if you need something more flexible:
|
|
|
53
61
|
# Useful if your mail server allows + dynamic email addresses like gmail.
|
|
54
62
|
MailSafe::Config.replacement_address = lambda { |address| "my-address+#{address.gsub(/[\w\-.]/, '_')}@gmail.com" }
|
|
55
63
|
end
|
|
64
|
+
```
|
|
56
65
|
|
|
57
66
|
When mail safe replaces an email address, it appends a notice to the bottom of the email body, such as:
|
|
58
67
|
|
|
68
|
+
```
|
|
59
69
|
**************************************************
|
|
60
70
|
This email originally had different recipients,
|
|
61
71
|
but MailSafe has prevented it from being sent to them.
|
|
@@ -68,13 +78,15 @@ When mail safe replaces an email address, it appends a notice to the bottom of t
|
|
|
68
78
|
- external-address-3@domain.com
|
|
69
79
|
|
|
70
80
|
**************************************************
|
|
81
|
+
```
|
|
82
|
+
## Version Compatibility and Continuous Integration
|
|
83
|
+
|
|
84
|
+
Tested with [Travis](https://travis-ci.org/watu/mail_safe) using Ruby 1.9, 2.0 and 2.1 against actionmailer 3.2, 4.0 and 4.1. 
|
|
71
85
|
|
|
72
|
-
== Version Compatibility and Continuous Integration
|
|
73
86
|
|
|
74
|
-
|
|
75
|
-
and any version of actionmailer since 1.3.6 (the version used by rails 1.2.6), including 3.0.0. The builds (linked to above)
|
|
76
|
-
use {ginger}[http://github.com/freelancing-god/ginger] to run the specs against 16 different versions of actionmailer.
|
|
87
|
+
## Copyright
|
|
77
88
|
|
|
78
|
-
|
|
89
|
+
Copyright (c) 2009-2010 Myron Marston, Kashless.org.
|
|
90
|
+
Copyright (c) 2014, Watu
|
|
79
91
|
|
|
80
|
-
|
|
92
|
+
See LICENSE for details.
|
data/Rakefile
CHANGED
|
@@ -1,54 +1,16 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
3
|
-
|
|
4
|
-
begin
|
|
5
|
-
require 'jeweler'
|
|
6
|
-
Jeweler::Tasks.new do |gem|
|
|
7
|
-
gem.name = "mail_safe"
|
|
8
|
-
gem.summary = %Q{Keep your ActionMailer emails from escaping into the wild during development.}
|
|
9
|
-
gem.email = "myron.marston@gmail.com"
|
|
10
|
-
gem.homepage = "http://github.com/myronmarston/mail_safe"
|
|
11
|
-
gem.authors = ["Myron Marston"]
|
|
12
|
-
|
|
13
|
-
gem.add_dependency 'actionmailer', '>= 1.3.6'
|
|
14
|
-
gem.add_development_dependency 'rspec', '>= 1.2.9'
|
|
15
|
-
|
|
16
|
-
gem.files.exclude 'vendor/ginger'
|
|
17
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
|
18
|
-
end
|
|
19
|
-
rescue LoadError
|
|
20
|
-
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
|
21
|
-
end
|
|
22
|
-
|
|
1
|
+
require "rubygems"
|
|
2
|
+
require "bundler/setup"
|
|
3
|
+
require "bundler/gem_tasks"
|
|
23
4
|
require "rspec/core/rake_task"
|
|
24
|
-
|
|
25
|
-
#t.rspec_opts = %w[--format documentation]
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
task :spec => :check_dependencies if defined?(Jeweler)
|
|
5
|
+
require 'rdoc/task'
|
|
29
6
|
|
|
30
|
-
|
|
7
|
+
RSpec::Core::RakeTask.new(:test)
|
|
31
8
|
|
|
32
|
-
require 'rake/rdoctask'
|
|
33
9
|
Rake::RDocTask.new do |rdoc|
|
|
34
|
-
if File.exist?('VERSION.yml')
|
|
35
|
-
require 'yaml' unless defined?(YAML) # seems to be needed for ruby 1.9.1
|
|
36
|
-
config = YAML.load(File.read('VERSION.yml'))
|
|
37
|
-
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
|
38
|
-
else
|
|
39
|
-
version = ""
|
|
40
|
-
end
|
|
41
|
-
|
|
42
10
|
rdoc.rdoc_dir = 'rdoc'
|
|
43
|
-
rdoc.title = "mail_safe #{
|
|
11
|
+
rdoc.title = "mail_safe #{MailSafe::VERSION}"
|
|
44
12
|
rdoc.rdoc_files.include('README*')
|
|
45
13
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
46
14
|
end
|
|
47
15
|
|
|
48
|
-
|
|
49
|
-
task :ginger do
|
|
50
|
-
$LOAD_PATH << File.join(*%w[vendor ginger lib])
|
|
51
|
-
ARGV.clear
|
|
52
|
-
ARGV << 'spec'
|
|
53
|
-
load File.join(*%w[vendor ginger bin ginger])
|
|
54
|
-
end
|
|
16
|
+
task :default => :test
|
data/lib/mail_safe.rb
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
require 'action_mailer'
|
|
2
|
-
require '
|
|
2
|
+
require 'active_support/core_ext/class/attribute_accessors' # to be able to use cattr_accessor
|
|
3
3
|
|
|
4
4
|
require 'mail_safe/config'
|
|
5
5
|
require 'mail_safe/address_replacer'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
require 'mail_safe/rails2_hook'
|
|
9
|
-
else
|
|
10
|
-
require 'mail_safe/rails3_hook'
|
|
11
|
-
end
|
|
7
|
+
require 'mail_safe/rails_hook'
|
|
@@ -7,19 +7,18 @@ module MailSafe
|
|
|
7
7
|
replaced_addresses = {}
|
|
8
8
|
|
|
9
9
|
ADDRESS_TYPES.each do |address_type|
|
|
10
|
-
if addresses = mail.
|
|
10
|
+
if addresses = mail[address_type].try(:value)
|
|
11
11
|
new_addresses = []
|
|
12
12
|
|
|
13
|
-
addresses.each do |a|
|
|
13
|
+
Array(addresses).each do |a|
|
|
14
14
|
new_addresses << if MailSafe::Config.is_internal_address?(a)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
a
|
|
16
|
+
else
|
|
17
|
+
(replaced_addresses[address_type] ||= []) << a
|
|
18
|
+
MailSafe::Config.get_replacement_address(a)
|
|
19
|
+
end
|
|
20
20
|
end
|
|
21
|
-
|
|
22
|
-
mail.send("#{address_type}=", new_addresses)
|
|
21
|
+
mail.send("#{address_type}=", new_addresses.uniq)
|
|
23
22
|
end
|
|
24
23
|
end
|
|
25
24
|
|
|
@@ -95,28 +94,9 @@ The original recipients were:
|
|
|
95
94
|
add_postscript(part, postscript)
|
|
96
95
|
end
|
|
97
96
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
def add_postscript(part, postscript)
|
|
102
|
-
body = part.body + postscript
|
|
103
|
-
|
|
104
|
-
# taken from action mailer:
|
|
105
|
-
# http://github.com/rails/rails/blob/05d7409ae5fd423be6f747ad553f659fcecbf548/actionmailer/lib/action_mailer/part.rb#L58-65
|
|
106
|
-
case part.content_transfer_encoding.to_s.downcase
|
|
107
|
-
when "base64" then
|
|
108
|
-
part.body = TMail::Base64.folding_encode(body)
|
|
109
|
-
when "quoted-printable"
|
|
110
|
-
part.body = [normalize_new_lines(body)].pack("M*")
|
|
111
|
-
else
|
|
112
|
-
part.body = body
|
|
113
|
-
end
|
|
114
|
-
end
|
|
115
|
-
else
|
|
116
|
-
def add_postscript(part, postscript)
|
|
117
|
-
postscript = postscript.html_safe if postscript.respond_to?(:html_safe)
|
|
118
|
-
part.body = part.body.to_s + postscript
|
|
119
|
-
end
|
|
97
|
+
def add_postscript(part, postscript)
|
|
98
|
+
postscript = postscript.html_safe if postscript.respond_to?(:html_safe)
|
|
99
|
+
part.body = part.body.to_s + postscript
|
|
120
100
|
end
|
|
121
101
|
end
|
|
122
102
|
end
|
data/lib/mail_safe/config.rb
CHANGED
|
@@ -29,13 +29,14 @@ module MailSafe
|
|
|
29
29
|
def self.developer_email_address
|
|
30
30
|
unless defined?(@@developer_email_address)
|
|
31
31
|
@@developer_email_address = begin
|
|
32
|
-
`git config user.email`.
|
|
32
|
+
`git config user.email`.strip
|
|
33
33
|
rescue
|
|
34
34
|
nil
|
|
35
35
|
end
|
|
36
|
+
@@developer_email_address = nil if @@developer_email_address.blank?
|
|
36
37
|
end
|
|
37
38
|
|
|
38
39
|
@@developer_email_address
|
|
39
40
|
end
|
|
40
41
|
end
|
|
41
|
-
end
|
|
42
|
+
end
|
data/mail_safe.gemspec
CHANGED
|
@@ -1,66 +1,34 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "mail_safe/version"
|
|
5
5
|
|
|
6
|
-
Gem::Specification.new do |
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "mail_safe"
|
|
8
|
+
spec.version = MailSafe::VERSION
|
|
9
|
+
spec.authors = ["Myron Marston", "Juan José Conti"]
|
|
10
|
+
spec.email = ["myron.marston@gmail.com", "jjconti@gmail.com"]
|
|
11
|
+
spec.summary = %q{Keep your ActionMailer emails from escaping into the wild during development.}
|
|
12
|
+
spec.description = %q{Mail safe provides a safety net while you"re developing an application that uses ActionMailer.
|
|
13
|
+
It keeps emails from escaping into the wild.
|
|
9
14
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"README.rdoc"
|
|
17
|
-
]
|
|
18
|
-
s.files = [
|
|
19
|
-
".document",
|
|
20
|
-
".gitignore",
|
|
21
|
-
"LICENSE",
|
|
22
|
-
"README.rdoc",
|
|
23
|
-
"Rakefile",
|
|
24
|
-
"VERSION.yml",
|
|
25
|
-
"autotest/discover.rb",
|
|
26
|
-
"ginger_scenarios.rb",
|
|
27
|
-
"lib/mail_safe.rb",
|
|
28
|
-
"lib/mail_safe/address_replacer.rb",
|
|
29
|
-
"lib/mail_safe/config.rb",
|
|
30
|
-
"lib/mail_safe/rails2_hook.rb",
|
|
31
|
-
"lib/mail_safe/rails3_hook.rb",
|
|
32
|
-
"mail_safe.gemspec",
|
|
33
|
-
"spec/config_spec.rb",
|
|
34
|
-
"spec/mailer_spec.rb",
|
|
35
|
-
"spec/mailers/test_mailer.rb",
|
|
36
|
-
"spec/spec_helper.rb"
|
|
37
|
-
]
|
|
38
|
-
s.homepage = %q{http://github.com/myronmarston/mail_safe}
|
|
39
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
|
40
|
-
s.require_paths = ["lib"]
|
|
41
|
-
s.rubygems_version = %q{1.3.7}
|
|
42
|
-
s.summary = %q{Keep your ActionMailer emails from escaping into the wild during development.}
|
|
43
|
-
s.test_files = [
|
|
44
|
-
"spec/config_spec.rb",
|
|
45
|
-
"spec/mailer_spec.rb",
|
|
46
|
-
"spec/mailers/test_mailer.rb",
|
|
47
|
-
"spec/spec_helper.rb"
|
|
48
|
-
]
|
|
15
|
+
Once you"ve installed and configured this gem, you can rest assure that your app won"t send
|
|
16
|
+
emails to external email addresses. Instead, emails that would normally be delivered to external
|
|
17
|
+
addresses will be sent to an address of your choosing, and the body of the email will be appended
|
|
18
|
+
with a note stating where the email was originally intended to go.}
|
|
19
|
+
spec.homepage = "http://github.com/myronmarston/mail_safe"
|
|
20
|
+
spec.license = "MIT"
|
|
49
21
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
22
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
23
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
24
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
25
|
+
spec.require_paths = ["lib"]
|
|
53
26
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
|
57
|
-
else
|
|
58
|
-
s.add_dependency(%q<actionmailer>, [">= 1.3.6"])
|
|
59
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
|
60
|
-
end
|
|
61
|
-
else
|
|
62
|
-
s.add_dependency(%q<actionmailer>, [">= 1.3.6"])
|
|
63
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
|
64
|
-
end
|
|
65
|
-
end
|
|
27
|
+
spec.add_dependency "actionmailer", ">= 3.0.0"
|
|
28
|
+
spec.add_dependency "coveralls"
|
|
66
29
|
|
|
30
|
+
spec.add_development_dependency "bundler"
|
|
31
|
+
spec.add_development_dependency "rake"
|
|
32
|
+
spec.add_development_dependency "rspec", "~> 3.0", ">= 3.0.0"
|
|
33
|
+
spec.add_development_dependency "appraisal"
|
|
34
|
+
end
|
data/spec/config_spec.rb
CHANGED
|
@@ -11,29 +11,29 @@ describe MailSafe::Config do
|
|
|
11
11
|
|
|
12
12
|
context 'when git is installed' do
|
|
13
13
|
before(:each) do
|
|
14
|
-
MailSafe::Config.
|
|
14
|
+
expect(MailSafe::Config).to receive(:`).with('git config user.email').once.and_return("developer@domain.com\n")
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
it "guesses the developer's email address using git" do
|
|
18
|
-
MailSafe::Config.developer_email_address.
|
|
18
|
+
expect(MailSafe::Config.developer_email_address).to eq('developer@domain.com')
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
it "caches the developer's email address so multiple system calls aren't made" do
|
|
22
|
-
MailSafe::Config.developer_email_address.
|
|
22
|
+
expect(MailSafe::Config.developer_email_address).to eq(MailSafe::Config.developer_email_address)
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
context 'when git is not installed' do
|
|
27
27
|
before(:each) do
|
|
28
|
-
MailSafe::Config.
|
|
28
|
+
expect(MailSafe::Config).to receive(:`).with('git config user.email').once.and_return(nil)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
it "returns nil" do
|
|
32
|
-
MailSafe::Config.developer_email_address.
|
|
32
|
+
expect(MailSafe::Config.developer_email_address).to be_nil
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
it "caches the developer's email address so multiple system calls aren't made" do
|
|
36
|
-
MailSafe::Config.developer_email_address.
|
|
36
|
+
expect(MailSafe::Config.developer_email_address).to eq(MailSafe::Config.developer_email_address)
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
end
|
|
@@ -47,29 +47,29 @@ describe MailSafe::Config do
|
|
|
47
47
|
context 'and #developer_email_address has a value' do
|
|
48
48
|
before(:each) do
|
|
49
49
|
@developer_address = 'developer@domain.com'
|
|
50
|
-
MailSafe::Config.
|
|
50
|
+
expect(MailSafe::Config).to receive(:developer_email_address).at_least(1).and_return(@developer_address)
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
it 'returns true when passed the developer email address' do
|
|
54
|
-
MailSafe::Config.is_internal_address?(@developer_address).
|
|
54
|
+
expect(MailSafe::Config.is_internal_address?(@developer_address)).to be_truthy
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
it 'returns true when passed the developer email address with different casing' do
|
|
58
|
-
MailSafe::Config.is_internal_address?(@developer_address.upcase).
|
|
58
|
+
expect(MailSafe::Config.is_internal_address?(@developer_address.upcase)).to be_truthy
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
it 'returns false when passed another email address' do
|
|
62
|
-
MailSafe::Config.is_internal_address?('another-address@domain.com').
|
|
62
|
+
expect(MailSafe::Config.is_internal_address?('another-address@domain.com')).to be_falsey
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
context 'and #developer_email_address has no value' do
|
|
67
67
|
before(:each) do
|
|
68
|
-
MailSafe::Config.
|
|
68
|
+
expect(MailSafe::Config).to receive(:developer_email_address).and_return(nil)
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
it 'raises an error' do
|
|
72
|
-
|
|
72
|
+
expect { MailSafe::Config.is_internal_address?('abc@foo.com') }.to raise_error(MailSafe::InvalidConfigSettingError)
|
|
73
73
|
end
|
|
74
74
|
end
|
|
75
75
|
end
|
|
@@ -80,11 +80,11 @@ describe MailSafe::Config do
|
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
it 'returns true if the address matches the regexp' do
|
|
83
|
-
MailSafe::Config.is_internal_address?('someone@example.com').
|
|
83
|
+
expect(MailSafe::Config.is_internal_address?('someone@example.com')).to be_truthy
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
it 'returns false if the address does not match the regexp' do
|
|
87
|
-
MailSafe::Config.is_internal_address?('someone@another-domain.com').
|
|
87
|
+
expect(MailSafe::Config.is_internal_address?('someone@another-domain.com')).to be_falsey
|
|
88
88
|
end
|
|
89
89
|
end
|
|
90
90
|
|
|
@@ -94,11 +94,11 @@ describe MailSafe::Config do
|
|
|
94
94
|
end
|
|
95
95
|
|
|
96
96
|
it 'returns true if the lambda returns true for the given address' do
|
|
97
|
-
MailSafe::Config.is_internal_address?('abc@foo.com').
|
|
97
|
+
expect(MailSafe::Config.is_internal_address?('abc@foo.com')).to be_truthy
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
it 'returns false if the lambda returns false for the given address' do
|
|
101
|
-
MailSafe::Config.is_internal_address?('a-long-address@example.com').
|
|
101
|
+
expect(MailSafe::Config.is_internal_address?('a-long-address@example.com')).to be_falsey
|
|
102
102
|
end
|
|
103
103
|
end
|
|
104
104
|
end
|
|
@@ -110,7 +110,7 @@ describe MailSafe::Config do
|
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
it 'returns the configured replacement address' do
|
|
113
|
-
MailSafe::Config.get_replacement_address('you@example.com').
|
|
113
|
+
expect(MailSafe::Config.get_replacement_address('you@example.com')).to eq('me@mydomain.com')
|
|
114
114
|
end
|
|
115
115
|
end
|
|
116
116
|
|
|
@@ -120,7 +120,7 @@ describe MailSafe::Config do
|
|
|
120
120
|
end
|
|
121
121
|
|
|
122
122
|
it 'returns the configured replacement address' do
|
|
123
|
-
MailSafe::Config.get_replacement_address('you@example.com').
|
|
123
|
+
expect(MailSafe::Config.get_replacement_address('you@example.com')).to eq('me+you@mydomain.com')
|
|
124
124
|
end
|
|
125
125
|
end
|
|
126
126
|
|
|
@@ -132,21 +132,21 @@ describe MailSafe::Config do
|
|
|
132
132
|
context 'and #developer_email_address has a value' do
|
|
133
133
|
before(:each) do
|
|
134
134
|
@developer_address = 'developer@domain.com'
|
|
135
|
-
MailSafe::Config.
|
|
135
|
+
expect(MailSafe::Config).to receive(:developer_email_address).at_least(1).and_return(@developer_address)
|
|
136
136
|
end
|
|
137
137
|
|
|
138
138
|
it 'returns the developer address' do
|
|
139
|
-
MailSafe::Config.get_replacement_address('you@example.com').
|
|
139
|
+
expect(MailSafe::Config.get_replacement_address('you@example.com')).to eq(@developer_address)
|
|
140
140
|
end
|
|
141
141
|
end
|
|
142
142
|
|
|
143
143
|
context 'and #developer_email_address has no value' do
|
|
144
144
|
before(:each) do
|
|
145
|
-
MailSafe::Config.
|
|
145
|
+
expect(MailSafe::Config).to receive(:developer_email_address).and_return(nil)
|
|
146
146
|
end
|
|
147
147
|
|
|
148
148
|
it 'raises an error' do
|
|
149
|
-
|
|
149
|
+
expect { MailSafe::Config.get_replacement_address('you@example.com') }.to raise_error(MailSafe::InvalidConfigSettingError)
|
|
150
150
|
end
|
|
151
151
|
end
|
|
152
152
|
end
|
data/spec/mailer_spec.rb
CHANGED
|
@@ -5,11 +5,7 @@ describe MailSafe do
|
|
|
5
5
|
HTML_POSTSCRIPT_PHRASE = /<p>\s+The original recipients were:\s+<\/p>/
|
|
6
6
|
|
|
7
7
|
def deliver_message(message_name, *args)
|
|
8
|
-
|
|
9
|
-
TestMailer.send("deliver_#{message_name}", *args)
|
|
10
|
-
else
|
|
11
|
-
TestMailer.send(message_name, *args).deliver
|
|
12
|
-
end
|
|
8
|
+
TestMailer.send(message_name, *args).deliver
|
|
13
9
|
end
|
|
14
10
|
|
|
15
11
|
RSpec::Matchers.define :have_addresses do |*expected|
|
|
@@ -18,34 +14,69 @@ describe MailSafe do
|
|
|
18
14
|
end
|
|
19
15
|
end
|
|
20
16
|
|
|
17
|
+
describe 'Delivering a plain text email to internal addresses with empty fields' do
|
|
18
|
+
before(:each) do
|
|
19
|
+
allow(MailSafe::Config).to receive(:is_internal_address?).and_return(true)
|
|
20
|
+
@email = deliver_message(:plain_text_message,
|
|
21
|
+
:to => 'internal-to@address.com')
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 'sends the email to the original addresses and dont fail' do
|
|
25
|
+
expect(@email[:to].value).to have_addresses('internal-to@address.com')
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
21
29
|
describe 'Delivering a plain text email to internal addresses' do
|
|
22
30
|
before(:each) do
|
|
23
|
-
MailSafe::Config.
|
|
24
|
-
@email = deliver_message(:plain_text_message,
|
|
31
|
+
allow(MailSafe::Config).to receive(:is_internal_address?).and_return(true)
|
|
32
|
+
@email = deliver_message(:plain_text_message,
|
|
33
|
+
:to => 'internal-to@address.com',
|
|
34
|
+
:bcc => 'internal-bcc@address.com',
|
|
35
|
+
:cc => 'internal-cc@address.com')
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it 'sends the email to the original addresses' do
|
|
39
|
+
expect(@email.to).to have_addresses('internal-to@address.com')
|
|
40
|
+
expect(@email.cc).to have_addresses('internal-cc@address.com')
|
|
41
|
+
expect(@email.bcc).to have_addresses('internal-bcc@address.com')
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it 'does not add a post script to the body' do
|
|
45
|
+
expect(@email.body.to_s).not_to match(TEXT_POSTSCRIPT_PHRASE)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
describe 'Delivering a plain text email to internal addresses with names' do
|
|
50
|
+
before(:each) do
|
|
51
|
+
allow(MailSafe::Config).to receive(:is_internal_address?).and_return(true)
|
|
52
|
+
@email = deliver_message(:plain_text_message,
|
|
53
|
+
:to => 'Internal To <internal-to@address.com>',
|
|
54
|
+
:bcc => 'Internal Bcc <internal-bcc@address.com>',
|
|
55
|
+
:cc => 'Internal Cc <internal-cc@address.com>')
|
|
25
56
|
end
|
|
26
57
|
|
|
27
58
|
it 'sends the email to the original addresses' do
|
|
28
|
-
@email.to
|
|
29
|
-
@email
|
|
30
|
-
@email
|
|
59
|
+
expect(@email[:to].value).to have_addresses('Internal To <internal-to@address.com>')
|
|
60
|
+
expect(@email[:cc].value).to have_addresses('Internal Cc <internal-cc@address.com>')
|
|
61
|
+
expect(@email[:bcc].value).to have_addresses('Internal Bcc <internal-bcc@address.com>')
|
|
31
62
|
end
|
|
32
63
|
|
|
33
64
|
it 'does not add a post script to the body' do
|
|
34
|
-
|
|
65
|
+
expect(@email.body.to_s).not_to match(TEXT_POSTSCRIPT_PHRASE)
|
|
35
66
|
end
|
|
36
67
|
end
|
|
37
68
|
|
|
38
69
|
describe 'Delivering a plain text email to external addresses' do
|
|
39
70
|
before(:each) do
|
|
40
|
-
MailSafe::Config.
|
|
41
|
-
MailSafe::Config.
|
|
71
|
+
allow(MailSafe::Config).to receive(:is_internal_address?).and_return(false)
|
|
72
|
+
allow(MailSafe::Config).to receive(:get_replacement_address).and_return('replacement@example.com')
|
|
42
73
|
@email = deliver_message(:plain_text_message, :to => 'external-to@address.com', :bcc => 'external-bcc@address.com', :cc => 'external-cc@address.com')
|
|
43
74
|
end
|
|
44
75
|
|
|
45
76
|
it 'sends the email to the replacement address' do
|
|
46
|
-
@email.to.
|
|
47
|
-
@email.cc.
|
|
48
|
-
@email.bcc.
|
|
77
|
+
expect(@email.to).to have_addresses('replacement@example.com')
|
|
78
|
+
expect(@email.cc).to have_addresses('replacement@example.com')
|
|
79
|
+
expect(@email.bcc).to have_addresses('replacement@example.com')
|
|
49
80
|
end
|
|
50
81
|
end
|
|
51
82
|
|
|
@@ -67,13 +98,13 @@ describe MailSafe do
|
|
|
67
98
|
end
|
|
68
99
|
|
|
69
100
|
it 'sends the email to the appropriate address' do
|
|
70
|
-
@email.to.
|
|
71
|
-
@email.cc.
|
|
72
|
-
@email.bcc.
|
|
101
|
+
expect(@email.to).to have_addresses('internal1@address.com', 'internal@domain.com')
|
|
102
|
+
expect(@email.cc).to have_addresses('internal1@address.com', 'internal2@address.com')
|
|
103
|
+
expect(@email.bcc).to have_addresses('internal@domain.com')
|
|
73
104
|
end
|
|
74
105
|
|
|
75
106
|
it 'adds a plain text post script to the body' do
|
|
76
|
-
@email.body.to_s.
|
|
107
|
+
expect(@email.body.to_s).to match(TEXT_POSTSCRIPT_PHRASE)
|
|
77
108
|
end
|
|
78
109
|
end
|
|
79
110
|
|
|
@@ -83,7 +114,7 @@ describe MailSafe do
|
|
|
83
114
|
end
|
|
84
115
|
|
|
85
116
|
it 'adds an html post script to the body' do
|
|
86
|
-
@email.body.to_s.
|
|
117
|
+
expect(@email.body.to_s).to match(HTML_POSTSCRIPT_PHRASE)
|
|
87
118
|
end
|
|
88
119
|
end
|
|
89
120
|
|
|
@@ -97,11 +128,11 @@ describe MailSafe do
|
|
|
97
128
|
end
|
|
98
129
|
|
|
99
130
|
it 'adds a text post script to the body of the text part' do
|
|
100
|
-
part(/text\/plain/).
|
|
131
|
+
expect(part(/text\/plain/)).to match(TEXT_POSTSCRIPT_PHRASE)
|
|
101
132
|
end
|
|
102
133
|
|
|
103
134
|
it 'adds an html post script to the body of the html part' do
|
|
104
|
-
part(/text\/html/).
|
|
135
|
+
expect(part(/text\/html/)).to match(HTML_POSTSCRIPT_PHRASE)
|
|
105
136
|
end
|
|
106
137
|
end
|
|
107
138
|
end
|
data/spec/mailers/test_mailer.rb
CHANGED
|
@@ -1,45 +1,37 @@
|
|
|
1
1
|
class TestMailer < ActionMailer::Base
|
|
2
|
-
# template root must be set for multipart emails, or ActionMailer will throw an exception.
|
|
3
|
-
if ActionMailer::VERSION::MAJOR == 2
|
|
4
|
-
self.template_root = File.dirname(__FILE__)
|
|
5
|
-
end
|
|
6
2
|
|
|
7
3
|
def plain_text_message(options)
|
|
8
|
-
setup_recipients(options)
|
|
9
|
-
from
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
setup = setup_recipients(options)
|
|
5
|
+
mail({from: 'test@mailsafe.org',
|
|
6
|
+
subject: "Plain text Message Test"}.update(setup)) do |format|
|
|
7
|
+
format.text { render text: "Here is the message body." }
|
|
8
|
+
end
|
|
12
9
|
end
|
|
13
10
|
|
|
14
11
|
def html_message(options)
|
|
15
|
-
setup_recipients(options)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
setup = setup_recipients(options)
|
|
13
|
+
body = "<p>Here is the message body.</p>"
|
|
14
|
+
body = body.html_safe if body.respond_to?(:html_safe)
|
|
15
|
+
mail({from: 'test@mailsafe.org',
|
|
16
|
+
subject: "Html Message Test"}.update(setup)) do |format|
|
|
17
|
+
format.html { render text: body }
|
|
18
|
+
end
|
|
22
19
|
end
|
|
23
20
|
|
|
24
21
|
def multipart_message(options)
|
|
25
|
-
setup_recipients(options)
|
|
26
|
-
from 'test@mailsafe.org'
|
|
27
|
-
subject "Html Message Test"
|
|
28
|
-
|
|
29
|
-
content_type 'multipart/alternative'
|
|
30
|
-
|
|
31
|
-
part :content_type => 'text/plain', :body => "Here is the message body."
|
|
32
|
-
|
|
22
|
+
setup = setup_recipients(options)
|
|
33
23
|
html_body = "<p>Here is the message body.</p>"
|
|
34
24
|
html_body = html_body.html_safe if html_body.respond_to?(:html_safe)
|
|
35
|
-
|
|
25
|
+
mail({from: 'test@mailsafe.org',
|
|
26
|
+
subject: "Html Message Test"}.update(setup)) do |format|
|
|
27
|
+
format.text { render text: "Here is the message body." }
|
|
28
|
+
format.html { render text: html_body }
|
|
29
|
+
end
|
|
36
30
|
end
|
|
37
31
|
|
|
38
32
|
protected
|
|
39
33
|
|
|
40
34
|
def setup_recipients(options)
|
|
41
|
-
|
|
42
|
-
cc options[:cc]
|
|
43
|
-
bcc options[:bcc]
|
|
35
|
+
options.select { |k,_| [:to, :cc, :bcc].include? k }
|
|
44
36
|
end
|
|
45
37
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "coveralls"
|
|
2
|
+
Coveralls.wear!
|
|
2
3
|
|
|
3
|
-
$LOAD_PATH << File.join(File.dirname(__FILE__), *%w[.. vendor ginger lib])
|
|
4
|
-
require 'ginger'
|
|
5
4
|
require 'mail_safe'
|
|
6
5
|
require 'mailers/test_mailer'
|
|
7
6
|
|
|
@@ -9,9 +8,7 @@ ActionMailer::Base.delivery_method = :test
|
|
|
9
8
|
|
|
10
9
|
require 'rspec'
|
|
11
10
|
RSpec.configure do |config|
|
|
12
|
-
config.
|
|
13
|
-
config.debug = true
|
|
11
|
+
config.color = true
|
|
14
12
|
config.filter_run :focus => true
|
|
15
13
|
config.run_all_when_everything_filtered = true
|
|
16
14
|
end
|
|
17
|
-
|
metadata
CHANGED
|
@@ -1,118 +1,167 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mail_safe
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
5
|
-
prerelease: false
|
|
6
|
-
segments:
|
|
7
|
-
- 0
|
|
8
|
-
- 3
|
|
9
|
-
- 1
|
|
10
|
-
version: 0.3.1
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.3.2
|
|
11
5
|
platform: ruby
|
|
12
|
-
authors:
|
|
6
|
+
authors:
|
|
13
7
|
- Myron Marston
|
|
8
|
+
- Juan José Conti
|
|
14
9
|
autorequire:
|
|
15
10
|
bindir: bin
|
|
16
11
|
cert_chain: []
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
dependencies:
|
|
21
|
-
- !ruby/object:Gem::Dependency
|
|
12
|
+
date: 2014-09-05 00:00:00.000000000 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
22
15
|
name: actionmailer
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
requirements:
|
|
18
|
+
- - ">="
|
|
19
|
+
- !ruby/object:Gem::Version
|
|
20
|
+
version: 3.0.0
|
|
21
|
+
type: :runtime
|
|
23
22
|
prerelease: false
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
requirements:
|
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
24
|
+
requirements:
|
|
27
25
|
- - ">="
|
|
28
|
-
- !ruby/object:Gem::Version
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
- !ruby/object:Gem::Version
|
|
27
|
+
version: 3.0.0
|
|
28
|
+
- !ruby/object:Gem::Dependency
|
|
29
|
+
name: coveralls
|
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
|
31
|
+
requirements:
|
|
32
|
+
- - ">="
|
|
33
|
+
- !ruby/object:Gem::Version
|
|
34
|
+
version: '0'
|
|
35
35
|
type: :runtime
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
prerelease: false
|
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
38
|
+
requirements:
|
|
39
|
+
- - ">="
|
|
40
|
+
- !ruby/object:Gem::Version
|
|
41
|
+
version: '0'
|
|
42
|
+
- !ruby/object:Gem::Dependency
|
|
43
|
+
name: bundler
|
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
|
45
|
+
requirements:
|
|
46
|
+
- - ">="
|
|
47
|
+
- !ruby/object:Gem::Version
|
|
48
|
+
version: '0'
|
|
49
|
+
type: :development
|
|
50
|
+
prerelease: false
|
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
52
|
+
requirements:
|
|
53
|
+
- - ">="
|
|
54
|
+
- !ruby/object:Gem::Version
|
|
55
|
+
version: '0'
|
|
56
|
+
- !ruby/object:Gem::Dependency
|
|
57
|
+
name: rake
|
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
|
59
|
+
requirements:
|
|
60
|
+
- - ">="
|
|
61
|
+
- !ruby/object:Gem::Version
|
|
62
|
+
version: '0'
|
|
63
|
+
type: :development
|
|
64
|
+
prerelease: false
|
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
66
|
+
requirements:
|
|
67
|
+
- - ">="
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: '0'
|
|
70
|
+
- !ruby/object:Gem::Dependency
|
|
38
71
|
name: rspec
|
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
|
73
|
+
requirements:
|
|
74
|
+
- - "~>"
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
version: '3.0'
|
|
77
|
+
- - ">="
|
|
78
|
+
- !ruby/object:Gem::Version
|
|
79
|
+
version: 3.0.0
|
|
80
|
+
type: :development
|
|
39
81
|
prerelease: false
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
82
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
83
|
+
requirements:
|
|
84
|
+
- - "~>"
|
|
85
|
+
- !ruby/object:Gem::Version
|
|
86
|
+
version: '3.0'
|
|
43
87
|
- - ">="
|
|
44
|
-
- !ruby/object:Gem::Version
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: 3.0.0
|
|
90
|
+
- !ruby/object:Gem::Dependency
|
|
91
|
+
name: appraisal
|
|
92
|
+
requirement: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
51
97
|
type: :development
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
98
|
+
prerelease: false
|
|
99
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
description: |-
|
|
105
|
+
Mail safe provides a safety net while you"re developing an application that uses ActionMailer.
|
|
106
|
+
It keeps emails from escaping into the wild.
|
|
56
107
|
|
|
108
|
+
Once you"ve installed and configured this gem, you can rest assure that your app won"t send
|
|
109
|
+
emails to external email addresses. Instead, emails that would normally be delivered to external
|
|
110
|
+
addresses will be sent to an address of your choosing, and the body of the email will be appended
|
|
111
|
+
with a note stating where the email was originally intended to go.
|
|
112
|
+
email:
|
|
113
|
+
- myron.marston@gmail.com
|
|
114
|
+
- jjconti@gmail.com
|
|
115
|
+
executables: []
|
|
57
116
|
extensions: []
|
|
58
|
-
|
|
59
|
-
|
|
117
|
+
extra_rdoc_files: []
|
|
118
|
+
files:
|
|
119
|
+
- ".gitignore"
|
|
120
|
+
- ".travis.yml"
|
|
121
|
+
- Appraisals
|
|
122
|
+
- Gemfile
|
|
123
|
+
- Gemfile.lock
|
|
60
124
|
- LICENSE
|
|
61
|
-
- README.
|
|
62
|
-
files:
|
|
63
|
-
- .document
|
|
64
|
-
- .gitignore
|
|
65
|
-
- LICENSE
|
|
66
|
-
- README.rdoc
|
|
125
|
+
- README.md
|
|
67
126
|
- Rakefile
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
127
|
+
- gemfiles/actionmailer_3_2.gemfile
|
|
128
|
+
- gemfiles/actionmailer_4_0.gemfile
|
|
129
|
+
- gemfiles/actionmailer_4_1.gemfile
|
|
71
130
|
- lib/mail_safe.rb
|
|
72
131
|
- lib/mail_safe/address_replacer.rb
|
|
73
132
|
- lib/mail_safe/config.rb
|
|
74
|
-
- lib/mail_safe/
|
|
75
|
-
- lib/mail_safe/
|
|
133
|
+
- lib/mail_safe/rails_hook.rb
|
|
134
|
+
- lib/mail_safe/version.rb
|
|
76
135
|
- mail_safe.gemspec
|
|
77
136
|
- spec/config_spec.rb
|
|
78
137
|
- spec/mailer_spec.rb
|
|
79
138
|
- spec/mailers/test_mailer.rb
|
|
80
139
|
- spec/spec_helper.rb
|
|
81
|
-
has_rdoc: true
|
|
82
140
|
homepage: http://github.com/myronmarston/mail_safe
|
|
83
|
-
licenses:
|
|
84
|
-
|
|
141
|
+
licenses:
|
|
142
|
+
- MIT
|
|
143
|
+
metadata: {}
|
|
85
144
|
post_install_message:
|
|
86
|
-
rdoc_options:
|
|
87
|
-
|
|
88
|
-
require_paths:
|
|
145
|
+
rdoc_options: []
|
|
146
|
+
require_paths:
|
|
89
147
|
- lib
|
|
90
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
|
-
|
|
92
|
-
requirements:
|
|
148
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
93
150
|
- - ">="
|
|
94
|
-
- !ruby/object:Gem::Version
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
version: "0"
|
|
99
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
|
-
none: false
|
|
101
|
-
requirements:
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '0'
|
|
153
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
|
+
requirements:
|
|
102
155
|
- - ">="
|
|
103
|
-
- !ruby/object:Gem::Version
|
|
104
|
-
|
|
105
|
-
segments:
|
|
106
|
-
- 0
|
|
107
|
-
version: "0"
|
|
156
|
+
- !ruby/object:Gem::Version
|
|
157
|
+
version: '0'
|
|
108
158
|
requirements: []
|
|
109
|
-
|
|
110
159
|
rubyforge_project:
|
|
111
|
-
rubygems_version:
|
|
160
|
+
rubygems_version: 2.2.2
|
|
112
161
|
signing_key:
|
|
113
|
-
specification_version:
|
|
162
|
+
specification_version: 4
|
|
114
163
|
summary: Keep your ActionMailer emails from escaping into the wild during development.
|
|
115
|
-
test_files:
|
|
164
|
+
test_files:
|
|
116
165
|
- spec/config_spec.rb
|
|
117
166
|
- spec/mailer_spec.rb
|
|
118
167
|
- spec/mailers/test_mailer.rb
|
data/.document
DELETED
data/VERSION.yml
DELETED
data/autotest/discover.rb
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Autotest.add_discovery { 'rspec2' }
|
data/ginger_scenarios.rb
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
require 'ginger'
|
|
2
|
-
|
|
3
|
-
def create_scenario(version)
|
|
4
|
-
scenario = Ginger::Scenario.new("Rails #{version}")
|
|
5
|
-
scenario[/^action_?mailer$/] = version
|
|
6
|
-
scenario[/^action_?pack$/] = version
|
|
7
|
-
scenario[/^active_?support$/] = version
|
|
8
|
-
scenario
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
Ginger.configure do |config|
|
|
12
|
-
config.aliases["action_mailer"] = "actionmailer"
|
|
13
|
-
config.aliases["action_pack"] = "actionpack"
|
|
14
|
-
config.aliases["active_support"] = "activesupport"
|
|
15
|
-
|
|
16
|
-
# Rails 3 doesn't work on Ruby 1.8.6 or 1.9.1 so skip it.
|
|
17
|
-
if RUBY_VERSION == '1.8.7'
|
|
18
|
-
rails3 = create_scenario('3.0.0')
|
|
19
|
-
rails3['mail'] = '2.2.7'
|
|
20
|
-
config.scenarios << rails3
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
%w( 2.3.9 2.3.8 2.3.5 2.3.4 2.3.3 2.3.2 ).each do |version|
|
|
24
|
-
config.scenarios << create_scenario(version)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
# Rails 2.3 was the first version that ran on ruby 1.9, so don't bother testing older versions.
|
|
28
|
-
if RUBY_VERSION =~ /^1\.8/
|
|
29
|
-
%w(
|
|
30
|
-
2.2.3 2.2.2
|
|
31
|
-
2.1.2 2.1.1 2.1.0
|
|
32
|
-
2.0.5 2.0.4 2.0.2 2.0.1 2.0.0
|
|
33
|
-
).each do |version|
|
|
34
|
-
config.scenarios << create_scenario(version)
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
rails126 = Ginger::Scenario.new("Rails 1.2.6")
|
|
38
|
-
rails126[/^action_?mailer$/] = '1.3.6'
|
|
39
|
-
rails126[/^action_?pack$/] = '1.13.6'
|
|
40
|
-
rails126[/^active_?support$/] = '1.4.4'
|
|
41
|
-
config.scenarios << rails126
|
|
42
|
-
end
|
|
43
|
-
end
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
module MailSafe
|
|
2
|
-
module ActionMailer
|
|
3
|
-
def self.included(base)
|
|
4
|
-
base.class_eval do
|
|
5
|
-
alias_method_chain :deliver!, :mail_safe
|
|
6
|
-
end
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def deliver_with_mail_safe!(mail = @mail)
|
|
10
|
-
MailSafe::AddressReplacer.replace_external_addresses(mail) if mail
|
|
11
|
-
deliver_without_mail_safe!(mail)
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
ActionMailer::Base.send(:include, MailSafe::ActionMailer) unless ActionMailer::Base.ancestors.include?(MailSafe::ActionMailer)
|