sanitize_email 0.3.7 → 0.3.8

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ data.tar.gz: 5ea66fb5f23e32fc62f9faa3390e03ba976de686
4
+ metadata.gz: 558b9904bb6cc7257c14065b7a49fc95a0a48317
5
+ SHA512:
6
+ data.tar.gz: 5cd8291a81b5cb7947ca90af7c823a0a66e3d6d054b8ea38fc1b6e06187f53d9bef865aadf0392df4d7dcba302519a3db9af6157a59940d0112127d0f4b17a9b
7
+ metadata.gz: b15485bf7dbac7a794f2ce9d80842c142f4e1b87c2b8ce3f0706173e20252ee0afffa136eb0d8748e5b9d3d7bd6807d637c51aad5e9545db89d80bf565ea1151
data/README.rdoc CHANGED
@@ -1,10 +1,12 @@
1
1
  = sanitize_email
2
2
 
3
+ NOTE ABOUT THIS VERSION: Sanitize email versions < 1 (i.e. major version 0) are to be kept compatible with Rails versions 3.1 and under. They will be built and released from the rails_3_1_and_below branch.
4
+
3
5
  This gem allows you to globally override your mail delivery settings. It's particularly helpful when you want to omit the delivery of email (e.g. in development/test environments) or alter the to/cc/bcc (e.g. in staging or demo environments) of all email generated from your application.
4
6
 
5
7
  It is a "configure it and forget it" type gem that requires very little setup. It includes some very innocuous monkey patching of ActionMailer::Base to work its magic.
6
8
 
7
- It currently solves three common problems in ruby web applications that use ActionMailer:
9
+ It currently solves five (3!) common problems in ruby web applications that use ActionMailer:
8
10
 
9
11
  === Working Locally with Production Data
10
12
 
@@ -27,37 +29,9 @@ If you install this gem on a production server (which I don't always do), you ca
27
29
 
28
30
  Pick standard or source install below.
29
31
 
30
- * Standard Install:
31
-
32
- [sudo] gem install sanitize_email
32
+ Standard Install (releases on the rails_3_1_and_below branch will remain within major version 0... FOREVER):
33
33
 
34
- * Source Install:
35
-
36
- mkdir -p ~/src
37
- cd ~/src
38
- git clone git://github.com/pboling/sanitize_email.git
39
- cd sanitize_email
40
- gem build sanitize_email.gemspec
41
- sudo gem install sanitize_email-0.3.7.gem # (Or whatever version gets built)
42
-
43
- Then in your environment.rb (if you are just going to use it from the console, you can require it as needed there, and skip the config.gem):
44
-
45
- config.gem 'sanitize_email'
46
-
47
- Then cd to your rails app to optionally freeze the gem into your app (if you roll this way):
48
-
49
- rake gems:freeze GEM=sanitize_email
50
-
51
- == Install as a Plugin
52
-
53
- Plugin using Git:
54
-
55
- # Installation as plugin works too! (let me know if you find any bugs, as I don't ever run it this way.)
56
- ./script/plugin install git://github.com/pboling/sanitize_email.git
57
-
58
- == Install as a Git Submodule (plugin)
59
-
60
- git submodule add git://github.com/pboling/sanitize_email.git vendor/plugins/sanitize_email
34
+ [sudo] gem install sanitize_email -v 0.3.8
61
35
 
62
36
  == Setup
63
37
 
@@ -135,13 +109,53 @@ Then if you want to send it to the actual user, instead of yourself
135
109
 
136
110
  > User.find(4).test_signup_email_user_only
137
111
 
112
+ == Alternate Installation Methods
113
+
114
+ Some of these are Rails version dependent.
115
+
116
+ Source Install:
117
+
118
+ mkdir -p ~/src
119
+ cd ~/src
120
+ git clone git://github.com/pboling/sanitize_email.git
121
+ cd sanitize_email
122
+ gem build sanitize_email.gemspec
123
+ sudo gem install sanitize_email-X.X.X.gem # (whatever version gets built)
124
+
125
+ Then in your environment.rb (if you are just going to use it from the console, you can require it as needed there, and skip the config.gem):
126
+
127
+ config.gem 'sanitize_email'
128
+
129
+ Then cd to your rails app to optionally freeze the gem into your app (if you roll this way):
130
+
131
+ rake gems:freeze GEM=sanitize_email
132
+
133
+ == Install as a Plugin
134
+
135
+ Plugin using Git:
136
+
137
+ # Installation as plugin works too! (let me know if you find any bugs, as I don't ever run it this way.)
138
+ ./script/plugin install git://github.com/pboling/sanitize_email.git
139
+
140
+ == Install as a Git Submodule (plugin)
141
+
142
+ git submodule add git://github.com/pboling/sanitize_email.git vendor/plugins/sanitize_email
143
+
144
+ == Run the Test Suite
145
+
146
+ The test suite must be run against Rails 2.3.X or below as it is coded to expect the Tmail objects under the hood.
147
+
148
+ rake test
149
+
138
150
  == Authors
139
151
 
140
- Peter Boling is the author of the gem/plugin. John Trupiano did the initial conversion from plugin to gem as well as improving the code.
152
+ Peter Boling is the original author of the code.
153
+ John Trupiano gemified and improved the code.
154
+ John kindly returned gem ownership to Peter, who currently maintains it.
141
155
 
142
156
  == Contributors
143
157
 
144
- George Anderson's work / improvements have been pulled in.
158
+ George Anderson's work / improvements have been pulled in, along with several other contributors, which can be seen in the Network view on github. Thanks!
145
159
 
146
160
  == References
147
161
  * {Source Code}[http://github.com/pboling/sanitize_email]
@@ -149,6 +163,6 @@ George Anderson's work / improvements have been pulled in.
149
163
  * {Peter's Original Writeup}[http://galtzo.blogspot.com/2008/11/sanitize-email-never-worry-about.html]
150
164
  * {Using sanitize_email to Preview HTML Emails Locally}[http://blog.smartlogicsolutions.com/2009/04/30/using-sanitize-email-to-preview-html-emails-locally/]
151
165
 
152
- Copyright (c) 2008-2010 {Peter H. Boling}[http://www.peterboling.com/about.html] of {9thBit LLC}[http://www.peterboling.com/]
166
+ Copyright (c) 2008-2012 {Peter H. Boling}[http://www.peterboling.com/about.html] of {9thBit LLC}[http://www.peterboling.com/]
153
167
  Copyright (c) 2009 {John Trupiano}[http://smartlogicsolutions.com/wiki/John_Trupiano] of {SmartLogic Solutions, LLC}[http://www.smartlogicsolutions.com]
154
168
  Released under the MIT license
data/Rakefile CHANGED
@@ -1,34 +1,5 @@
1
1
  require 'rake'
2
2
  require 'rake/testtask'
3
- require 'rake/rdoctask'
4
-
5
- begin
6
- require 'jeweler'
7
- Jeweler::Tasks.new do |gemspec|
8
- gemspec.name = "sanitize_email"
9
- gemspec.summary = "Tool to aid in development, testing, qa, and production troubleshooting of email issues without worrying that emails will get sent to actual live addresses."
10
- gemspec.description = %q{Test an application's email abilities without ever sending a message to actual live addresses}
11
- gemspec.email = ['peter.boling@gmail.com', 'jtrupiano@gmail.com', 'george@benevolentcode.com']
12
- gemspec.homepage = "http://github.com/pboling/sanitize_email"
13
- gemspec.authors = ["Peter Boling", "John Trupiano", "George Anderson"]
14
- gemspec.add_dependency 'actionmailer'
15
- gemspec.files = ["lib/sanitize_email/custom_environments.rb",
16
- "lib/sanitize_email/sanitize_email.rb",
17
- "lib/sanitize_email.rb",
18
- "init.rb",
19
- "MIT-LICENSE",
20
- "Rakefile",
21
- "README.rdoc",
22
- "sanitize_email.gemspec",
23
- "VERSION.yml",
24
- "test/test_helper.rb",
25
- "test/sample_mailer.rb",
26
- "test/sanitize_email_test.rb"]
27
- end
28
- Jeweler::GemcutterTasks.new
29
- rescue LoadError
30
- puts "Jeweler not available. Install it with: sudo gem install jeweler"
31
- end
32
3
 
33
4
  desc 'Default: run unit tests.'
34
5
  task :default => :test
@@ -39,40 +10,3 @@ Rake::TestTask.new(:test) do |t|
39
10
  t.pattern = 'test/**/*_test.rb'
40
11
  t.verbose = true
41
12
  end
42
-
43
- desc 'Generate documentation for the sanitize_email plugin.'
44
- Rake::RDocTask.new do |rdoc|
45
- config = YAML.load(File.read('VERSION.yml'))
46
- rdoc.rdoc_dir = 'rdoc'
47
- rdoc.title = "sanitize_email #{config[:major]}.#{config[:minor]}.#{config[:patch]}"
48
- rdoc.options << '--line-numbers' << '--inline-source'
49
- rdoc.rdoc_files.include('README*')
50
- rdoc.rdoc_files.include('lib/**/*.rb')
51
- end
52
-
53
- # Rubyforge documentation task
54
- begin
55
- require 'rake/contrib/sshpublisher'
56
- namespace :rubyforge do
57
-
58
- desc "Release gem and RDoc documentation to RubyForge"
59
- task :release => ["rubyforge:release:gem", "rubyforge:release:docs"]
60
-
61
- namespace :release do
62
- desc "Publish RDoc to RubyForge."
63
- task :docs => [:rdoc] do
64
- config = YAML.load(
65
- File.read(File.expand_path('~/.rubyforge/user-config.yml'))
66
- )
67
-
68
- host = "#{config['username']}@rubyforge.org"
69
- remote_dir = "/var/www/gforge-projects/johntrupiano/sanitize_email/"
70
- local_dir = 'rdoc'
71
-
72
- Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
73
- end
74
- end
75
- end
76
- rescue LoadError
77
- puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured."
78
- end
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
- ---
2
- :build:
1
+ ---
3
2
  :major: 0
4
3
  :minor: 3
5
- :patch: 7
4
+ :patch: 8
5
+ :build:
@@ -13,7 +13,7 @@ module NinthBit
13
13
 
14
14
  module ClassMethods
15
15
  def consider_local?
16
- local_environments.include?(defined?(Rails) ? Rails.env : RAILS_ENV)
16
+ local_environments.include?(defined?(Rails) && Rails.respond_to?(:env) ? Rails.env : RAILS_ENV)
17
17
  end
18
18
  end
19
19
 
@@ -76,7 +76,11 @@ module NinthBit
76
76
  #######
77
77
 
78
78
  def override_subject
79
- real_recipients.nil? ? real_subject : "(#{real_recipients}) #{real_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
80
84
  end
81
85
 
82
86
  def override_email(type)
@@ -95,6 +99,8 @@ module NinthBit
95
99
  return nil if real_addresses.nil?
96
100
  return sanitized_addresses if sanitized_addresses.nil? || !self.class.use_actual_email_as_sanitized_user_name
97
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]
98
104
  out = real_addresses.inject([]) do |result, real_recipient|
99
105
  result << sanitized_addresses.map{|sanitized| "#{real_recipient} <#{sanitized}>"}
100
106
  result
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sanitize_email}
8
- s.version = "0.3.7"
8
+ s.version = "0.3.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Peter Boling", "John Trupiano", "George Anderson"]
data/test/test_helper.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # Note tests require tmail to be the underlying message handler, so need to be run with Rails 2.3 or below
1
2
  require 'rubygems'
2
3
 
3
4
  vendored_rails = File.dirname(__FILE__) + '/../../../../vendor/rails'
metadata CHANGED
@@ -1,13 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sanitize_email
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 3
9
- - 7
10
- version: 0.3.7
4
+ version: 0.3.8
11
5
  platform: ruby
12
6
  authors:
13
7
  - Peter Boling
@@ -17,20 +11,16 @@ autorequire:
17
11
  bindir: bin
18
12
  cert_chain: []
19
13
 
20
- date: 2010-07-08 00:00:00 -04:00
21
- default_executable:
14
+ date: 2010-07-08 00:00:00 Z
22
15
  dependencies:
23
16
  - !ruby/object:Gem::Dependency
24
17
  name: actionmailer
25
18
  prerelease: false
26
19
  requirement: &id001 !ruby/object:Gem::Requirement
27
- none: false
28
20
  requirements:
29
- - - ">="
21
+ - &id002
22
+ - ">="
30
23
  - !ruby/object:Gem::Version
31
- hash: 3
32
- segments:
33
- - 0
34
24
  version: "0"
35
25
  type: :runtime
36
26
  version_requirements: *id001
@@ -58,37 +48,26 @@ files:
58
48
  - test/sample_mailer.rb
59
49
  - test/sanitize_email_test.rb
60
50
  - test/test_helper.rb
61
- has_rdoc: true
62
51
  homepage: http://github.com/pboling/sanitize_email
63
52
  licenses: []
64
53
 
54
+ metadata: {}
55
+
65
56
  post_install_message:
66
57
  rdoc_options:
67
58
  - --charset=UTF-8
68
59
  require_paths:
69
60
  - lib
70
61
  required_ruby_version: !ruby/object:Gem::Requirement
71
- none: false
72
62
  requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- hash: 3
76
- segments:
77
- - 0
78
- version: "0"
63
+ - *id002
79
64
  required_rubygems_version: !ruby/object:Gem::Requirement
80
- none: false
81
65
  requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- hash: 3
85
- segments:
86
- - 0
87
- version: "0"
66
+ - *id002
88
67
  requirements: []
89
68
 
90
69
  rubyforge_project:
91
- rubygems_version: 1.3.7
70
+ rubygems_version: 2.0.14
92
71
  signing_key:
93
72
  specification_version: 3
94
73
  summary: Tool to aid in development, testing, qa, and production troubleshooting of email issues without worrying that emails will get sent to actual live addresses.