sanitize_email 0.3.9 → 1.0.0.alpha2
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +2 -0
- data/CHANGELOG +23 -0
- data/Gemfile +11 -11
- data/Gemfile.lock +129 -0
- data/{LICENSE.txt → MIT-LICENSE} +1 -3
- data/README.rdoc +28 -71
- data/Rakefile +54 -9
- data/VERSION.yml +4 -4
- data/lib/sanitize_email.rb +28 -9
- data/lib/sanitize_email/config.rb +34 -0
- data/lib/sanitize_email/engine.rb +12 -0
- data/lib/sanitize_email/hook.rb +30 -0
- data/lib/sanitize_email/railtie.rb +12 -0
- data/lib/sanitize_email/sanitizer.rb +73 -0
- data/lib/sanitize_email/version.rb +3 -1
- data/sanitize_email.gemspec +80 -21
- data/spec/sanitize_email_spec.rb +68 -0
- data/spec/spec_helper.rb +40 -0
- data/spec/tmp/mail_dump/1343461037_3f3edd7/plain.html +76 -0
- metadata +201 -68
- checksums.yaml +0 -7
- data/.gitignore +0 -20
- data/CHANGELOG.md +0 -27
- data/lib/sanitize_email/custom_environments.rb +0 -21
- data/lib/sanitize_email/sanitize_email.rb +0 -114
- data/test/sample_mailer.rb +0 -24
- data/test/sanitize_email_test.rb +0 -76
- data/test/test_helper.rb +0 -25
metadata
CHANGED
@@ -1,103 +1,236 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: sanitize_email
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0.alpha2
|
5
|
+
prerelease: 6
|
5
6
|
platform: ruby
|
6
|
-
authors:
|
7
|
+
authors:
|
7
8
|
- Peter Boling
|
8
9
|
- John Trupiano
|
9
10
|
- George Anderson
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
date: 2012-07-28 00:00:00.000000000 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: rails
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ! '>'
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '3'
|
24
|
+
type: :runtime
|
18
25
|
prerelease: false
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version:
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ! '>'
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '3'
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: actionmailer
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
35
|
+
none: false
|
36
|
+
requirements:
|
37
|
+
- - ! '>'
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '3'
|
28
40
|
type: :runtime
|
29
|
-
version_requirements: *id001
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: bundler
|
32
41
|
prerelease: false
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>'
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: jeweler
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: letter_opener
|
66
|
+
requirement: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ! '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
type: :development
|
73
|
+
prerelease: false
|
74
|
+
version_requirements: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: launchy
|
82
|
+
requirement: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: rspec
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
38
104
|
type: :development
|
39
|
-
version_requirements: *id002
|
40
|
-
- !ruby/object:Gem::Dependency
|
41
|
-
name: rake
|
42
105
|
prerelease: false
|
43
|
-
|
44
|
-
|
45
|
-
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ! '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: mail
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
116
|
+
requirements:
|
117
|
+
- - ! '>='
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
46
120
|
type: :development
|
47
|
-
|
48
|
-
|
49
|
-
|
121
|
+
prerelease: false
|
122
|
+
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
124
|
+
requirements:
|
125
|
+
- - ! '>='
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
- !ruby/object:Gem::Dependency
|
129
|
+
name: rdoc
|
130
|
+
requirement: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '3.12'
|
136
|
+
type: :development
|
137
|
+
prerelease: false
|
138
|
+
version_requirements: !ruby/object:Gem::Requirement
|
139
|
+
none: false
|
140
|
+
requirements:
|
141
|
+
- - ! '>='
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '3.12'
|
144
|
+
- !ruby/object:Gem::Dependency
|
145
|
+
name: reek
|
146
|
+
requirement: !ruby/object:Gem::Requirement
|
147
|
+
none: false
|
148
|
+
requirements:
|
149
|
+
- - ! '>='
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: 1.2.8
|
152
|
+
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
none: false
|
156
|
+
requirements:
|
157
|
+
- - ! '>='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 1.2.8
|
160
|
+
- !ruby/object:Gem::Dependency
|
161
|
+
name: roodi
|
162
|
+
requirement: !ruby/object:Gem::Requirement
|
163
|
+
none: false
|
164
|
+
requirements:
|
165
|
+
- - ! '>='
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: 2.1.0
|
168
|
+
type: :development
|
169
|
+
prerelease: false
|
170
|
+
version_requirements: !ruby/object:Gem::Requirement
|
171
|
+
none: false
|
172
|
+
requirements:
|
173
|
+
- - ! '>='
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: 2.1.0
|
176
|
+
description: Tool to aid in development, testing, qa, and production troubleshooting
|
177
|
+
of email issues without worrying that emails will get sent to actual live addresses.
|
178
|
+
email:
|
50
179
|
- peter.boling@gmail.com
|
51
180
|
- jtrupiano@gmail.com
|
52
181
|
- george@benevolentcode.com
|
53
182
|
executables: []
|
54
|
-
|
55
183
|
extensions: []
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
-
|
61
|
-
- CHANGELOG.md
|
184
|
+
extra_rdoc_files:
|
185
|
+
- README.rdoc
|
186
|
+
files:
|
187
|
+
- .rspec
|
188
|
+
- CHANGELOG
|
62
189
|
- Gemfile
|
63
190
|
- Gemfile.lock
|
64
|
-
- LICENSE
|
191
|
+
- MIT-LICENSE
|
65
192
|
- README.rdoc
|
66
193
|
- Rakefile
|
67
194
|
- VERSION.yml
|
68
195
|
- init.rb
|
69
196
|
- lib/sanitize_email.rb
|
70
|
-
- lib/sanitize_email/
|
71
|
-
- lib/sanitize_email/
|
197
|
+
- lib/sanitize_email/config.rb
|
198
|
+
- lib/sanitize_email/engine.rb
|
199
|
+
- lib/sanitize_email/hook.rb
|
200
|
+
- lib/sanitize_email/railtie.rb
|
201
|
+
- lib/sanitize_email/sanitizer.rb
|
72
202
|
- lib/sanitize_email/version.rb
|
73
203
|
- sanitize_email.gemspec
|
74
|
-
-
|
75
|
-
-
|
76
|
-
-
|
204
|
+
- spec/sanitize_email_spec.rb
|
205
|
+
- spec/spec_helper.rb
|
206
|
+
- spec/tmp/mail_dump/1343461037_3f3edd7/plain.html
|
77
207
|
homepage: http://github.com/pboling/sanitize_email
|
78
|
-
licenses:
|
208
|
+
licenses:
|
79
209
|
- MIT
|
80
|
-
metadata: {}
|
81
|
-
|
82
210
|
post_install_message:
|
83
|
-
rdoc_options:
|
84
|
-
|
85
|
-
require_paths:
|
211
|
+
rdoc_options: []
|
212
|
+
require_paths:
|
86
213
|
- lib
|
87
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
214
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
215
|
+
none: false
|
216
|
+
requirements:
|
217
|
+
- - ! '>='
|
218
|
+
- !ruby/object:Gem::Version
|
219
|
+
version: '0'
|
220
|
+
segments:
|
221
|
+
- 0
|
222
|
+
hash: -3597304773529474340
|
223
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
224
|
+
none: false
|
225
|
+
requirements:
|
226
|
+
- - ! '>'
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: 1.3.1
|
93
229
|
requirements: []
|
94
|
-
|
95
230
|
rubyforge_project:
|
96
|
-
rubygems_version:
|
231
|
+
rubygems_version: 1.8.24
|
97
232
|
signing_key:
|
98
|
-
specification_version:
|
99
|
-
summary: Test an application's email abilities without ever sending a message to actual
|
100
|
-
|
101
|
-
|
102
|
-
- test/sanitize_email_test.rb
|
103
|
-
- test/test_helper.rb
|
233
|
+
specification_version: 3
|
234
|
+
summary: Test an application's email abilities without ever sending a message to actual
|
235
|
+
live addresses
|
236
|
+
test_files: []
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
data.tar.gz: 9af119111ca36fabf71be862decaf4ea99a2ebb0
|
4
|
-
metadata.gz: e10fbe1c7a189387ad2b3516c520fefd1fcb389c
|
5
|
-
SHA512:
|
6
|
-
data.tar.gz: f44f84718ae2c50c99344df317c91e02a2d2ed3d5936aaeca5bf7a28080363ab7197edc31b9b058c6c01f39483aefdfbeb8ad7af2a02a4cccb926f68f46821ce
|
7
|
-
metadata.gz: f14cbab8d2da7a328396e32ba71dc075a6a4ab3fed9c5d7d0f64a520e524ad5a32393fde84226e43afd53e0dc89e71a154dd2ce12c1ed34c8a1a6f6a665ecce2
|
data/.gitignore
DELETED
data/CHANGELOG.md
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# Version 0.3.9 13.MAR.2014
|
2
|
-
|
3
|
-
- lock down version dependency of actionmailer ">= 0" and "<= 3.1", so a fresh install succeeds
|
4
|
-
- Added proper best practice conventions like SanitizeEmail::VERSION (== '0.3.9')
|
5
|
-
- all new gemspec
|
6
|
-
|
7
|
-
# Version 0.3.8 12.MAR.2014
|
8
|
-
- (Rubygems.org has the wrong release date, my bad, (⋟﹏⋞) jeweler!)
|
9
|
-
- Convert to Bundler by Peter Boling
|
10
|
-
- Improved Readme by Peter Boling
|
11
|
-
- Support use_actual_email_prepended_to_subject by Johnathan Ritzi
|
12
|
-
- Fix environment check for old versions of Rails by Johnathan Ritzi
|
13
|
-
|
14
|
-
#Version 0.3.7 08.JUL.2010
|
15
|
-
|
16
|
-
- Improved Installation instructions
|
17
|
-
- Fixed so tests run from inside a rails app (previously only ran standalone)
|
18
|
-
|
19
|
-
# Version 0.3.6 10.NOV.2009
|
20
|
-
|
21
|
-
- Fixed Installation instructions
|
22
|
-
- Improved README
|
23
|
-
|
24
|
-
# Version 0.3.5 10.NOV.2009
|
25
|
-
|
26
|
-
- Fixed require paths
|
27
|
-
- added about.yml and this CHANGELOG
|
@@ -1,21 +0,0 @@
|
|
1
|
-
#Copyright (c) 2008-9 Peter H. Boling of 9thBit LLC
|
2
|
-
#Released under the MIT license
|
3
|
-
|
4
|
-
module NinthBit
|
5
|
-
module CustomEnvironments
|
6
|
-
|
7
|
-
def self.included(base)
|
8
|
-
base.extend(ClassMethods)
|
9
|
-
|
10
|
-
base.cattr_accessor :local_environments
|
11
|
-
base.local_environments = %w( development test )
|
12
|
-
end
|
13
|
-
|
14
|
-
module ClassMethods
|
15
|
-
def consider_local?
|
16
|
-
local_environments.include?(defined?(Rails) && Rails.respond_to?(:env) ? Rails.env : RAILS_ENV)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
@@ -1,114 +0,0 @@
|
|
1
|
-
#Copyright (c) 2008-9 Peter H. Boling of 9thBit LLC
|
2
|
-
#Released under the MIT license
|
3
|
-
|
4
|
-
module NinthBit
|
5
|
-
module SanitizeEmail
|
6
|
-
|
7
|
-
def self.included(base)
|
8
|
-
|
9
|
-
# Adds the following class attributes to the classes that include NinthBit::SanitizeEmail
|
10
|
-
base.cattr_accessor :force_sanitize
|
11
|
-
base.force_sanitize = nil
|
12
|
-
|
13
|
-
# Specify the BCC addresses for the messages that go out in 'local' environments
|
14
|
-
base.cattr_accessor :sanitized_bcc
|
15
|
-
base.sanitized_bcc = nil
|
16
|
-
|
17
|
-
# Specify the CC addresses for the messages that go out in 'local' environments
|
18
|
-
base.cattr_accessor :sanitized_cc
|
19
|
-
base.sanitized_cc = nil
|
20
|
-
|
21
|
-
# The recipient addresses for the messages, either as a string (for a single
|
22
|
-
# address) or an array (for multiple addresses) that go out in 'local' environments
|
23
|
-
base.cattr_accessor :sanitized_recipients
|
24
|
-
base.sanitized_recipients = nil
|
25
|
-
|
26
|
-
# Use the 'real' email address as the username for the sanitized email address
|
27
|
-
# e.g. "real@example.com <sanitized@example.com>"
|
28
|
-
base.cattr_accessor :use_actual_email_as_sanitized_user_name
|
29
|
-
base.use_actual_email_as_sanitized_user_name = false
|
30
|
-
|
31
|
-
# Prepend the 'real' email address onto the Subject line of the message
|
32
|
-
# e.g. "real@example.com rest of subject"
|
33
|
-
base.cattr_accessor :use_actual_email_prepended_to_subject
|
34
|
-
base.use_actual_email_prepended_to_subject = false
|
35
|
-
|
36
|
-
base.class_eval do
|
37
|
-
# We need to alias these methods so that our new methods get used instead
|
38
|
-
alias :real_bcc :bcc
|
39
|
-
alias :real_cc :cc
|
40
|
-
alias :real_recipients :recipients
|
41
|
-
alias :real_subject :subject
|
42
|
-
|
43
|
-
def localish?
|
44
|
-
# consider_local is a method in sanitize_email/lib/custom_environments.rb
|
45
|
-
# it is included in ActionMailer in sanitize_email/init.rb
|
46
|
-
!self.class.force_sanitize.nil? ? self.class.force_sanitize : self.class.consider_local?
|
47
|
-
end
|
48
|
-
|
49
|
-
def subject(*lines)
|
50
|
-
real_subject(*lines)
|
51
|
-
localish? ? override_subject : real_subject
|
52
|
-
end
|
53
|
-
|
54
|
-
def recipients(*addresses)
|
55
|
-
real_recipients(*addresses)
|
56
|
-
if localish?
|
57
|
-
puts "sanitize_email error: sanitized_recipients is not set" if self.class.sanitized_recipients.nil?
|
58
|
-
override_email(:recipients)
|
59
|
-
else
|
60
|
-
real_recipients
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def cc(*addresses)
|
65
|
-
real_cc(*addresses)
|
66
|
-
localish? ? override_email(:cc) : real_cc
|
67
|
-
end
|
68
|
-
|
69
|
-
def bcc(*addresses)
|
70
|
-
real_bcc(*addresses)
|
71
|
-
localish? ? override_email(:bcc) : real_bcc
|
72
|
-
end
|
73
|
-
|
74
|
-
#######
|
75
|
-
private
|
76
|
-
#######
|
77
|
-
|
78
|
-
def override_subject
|
79
|
-
if real_recipients.nil? || !self.class.use_actual_email_prepended_to_subject
|
80
|
-
real_subject
|
81
|
-
else
|
82
|
-
"(#{real_recipients}) #{real_subject}"
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def override_email(type)
|
87
|
-
real_addresses, sanitized_addresses =
|
88
|
-
case type
|
89
|
-
when :recipients
|
90
|
-
[real_recipients, self.class.sanitized_recipients]
|
91
|
-
when :cc
|
92
|
-
[real_cc, self.class.sanitized_cc]
|
93
|
-
when :bcc
|
94
|
-
[real_bcc, self.class.sanitized_bcc]
|
95
|
-
else raise "sanitize_email error: unknown email override"
|
96
|
-
end
|
97
|
-
|
98
|
-
# If there were no original recipients, then we DO NOT override the nil with the sanitized recipients
|
99
|
-
return nil if real_addresses.nil?
|
100
|
-
return sanitized_addresses if sanitized_addresses.nil? || !self.class.use_actual_email_as_sanitized_user_name
|
101
|
-
|
102
|
-
real_addresses = real_addresses.respond_to?(:inject) ? real_addresses : [real_addresses]
|
103
|
-
sanitized_addresses = sanitized_addresses.respond_to?(:map) ? sanitized_addresses : [sanitized_addresses]
|
104
|
-
out = real_addresses.inject([]) do |result, real_recipient|
|
105
|
-
result << sanitized_addresses.map{|sanitized| "#{real_recipient} <#{sanitized}>"}
|
106
|
-
result
|
107
|
-
end.flatten
|
108
|
-
return out
|
109
|
-
end
|
110
|
-
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end # end Module SanitizeEmail
|
114
|
-
end # end Module NinthBit
|