blackhole-mailer 0.0.1

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.
@@ -0,0 +1,3 @@
1
+ .rvmrc
2
+ doc/
3
+ .yardoc/
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,76 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ blackhole-mailer (0.0.1)
5
+ resque_mailer (~> 2.1.0)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actionmailer (3.2.12)
11
+ actionpack (= 3.2.12)
12
+ mail (~> 2.4.4)
13
+ actionpack (3.2.12)
14
+ activemodel (= 3.2.12)
15
+ activesupport (= 3.2.12)
16
+ builder (~> 3.0.0)
17
+ erubis (~> 2.7.0)
18
+ journey (~> 1.0.4)
19
+ rack (~> 1.4.5)
20
+ rack-cache (~> 1.2)
21
+ rack-test (~> 0.6.1)
22
+ sprockets (~> 2.2.1)
23
+ activemodel (3.2.12)
24
+ activesupport (= 3.2.12)
25
+ builder (~> 3.0.0)
26
+ activesupport (3.2.12)
27
+ i18n (~> 0.6)
28
+ multi_json (~> 1.0)
29
+ bluecloth (2.0.11)
30
+ builder (3.0.4)
31
+ diff-lcs (1.2.1)
32
+ erubis (2.7.0)
33
+ hike (1.2.1)
34
+ i18n (0.6.4)
35
+ journey (1.0.4)
36
+ mail (2.4.4)
37
+ i18n (>= 0.4.0)
38
+ mime-types (~> 1.16)
39
+ treetop (~> 1.4.8)
40
+ mime-types (1.21)
41
+ multi_json (1.7.0)
42
+ polyglot (0.3.3)
43
+ rack (1.4.5)
44
+ rack-cache (1.2)
45
+ rack (>= 0.4)
46
+ rack-test (0.6.2)
47
+ rack (>= 1.0)
48
+ resque_mailer (2.1.0)
49
+ actionmailer (~> 3.0)
50
+ rspec (2.13.0)
51
+ rspec-core (~> 2.13.0)
52
+ rspec-expectations (~> 2.13.0)
53
+ rspec-mocks (~> 2.13.0)
54
+ rspec-core (2.13.1)
55
+ rspec-expectations (2.13.0)
56
+ diff-lcs (>= 1.1.3, < 2.0)
57
+ rspec-mocks (2.13.0)
58
+ sprockets (2.2.2)
59
+ hike (~> 1.2)
60
+ multi_json (~> 1.0)
61
+ rack (~> 1.0)
62
+ tilt (~> 1.1, != 1.3.0)
63
+ tilt (1.3.6)
64
+ treetop (1.4.12)
65
+ polyglot
66
+ polyglot (>= 0.3.1)
67
+ yard (0.8.5.2)
68
+
69
+ PLATFORMS
70
+ ruby
71
+
72
+ DEPENDENCIES
73
+ blackhole-mailer!
74
+ bluecloth (~> 2.0.11)
75
+ rspec (~> 2.4)
76
+ yard
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 K$
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,56 @@
1
+ blackhole-mailer
2
+ ====================
3
+ A mail utility so dense, no message can escape.
4
+
5
+
6
+ Installation Gemspec
7
+ ------------
8
+ gem 'blackhole-mailer'
9
+
10
+
11
+ Sample Use
12
+ ------------------
13
+
14
+ Calling `abort_delivery` sends the message into a blackhole & the message is never sent.
15
+
16
+ class UserMailer < BaseMailer
17
+ def daily(user_id)
18
+ @user = User.find(user_id)
19
+ abort_delivery unless @user.wants_daily?
20
+ mail(:to => @user.email,
21
+ :from => "MyApp <hello@myapp.com>",
22
+ :subject => "Daily mailer from MyApp!")
23
+ end
24
+ end
25
+
26
+
27
+ Further, you can inherit from AsyncMailer to get all the benefits of blackhole-mailer & integration with resque_mailer.
28
+
29
+
30
+ Submitting an Issue
31
+ -------------------
32
+ We use the [GitHub issue tracker](http://github.com/kdmny/blackhole-mailer/issues) to track bugs and
33
+ features. Before submitting a bug report or feature request, check to make sure it hasn't already
34
+ been submitted. You can indicate support for an existing issuse by voting it up. When submitting a
35
+ bug report, please include a [Gist](http://gist.github.com/) that includes a stack trace and any
36
+ details that may be necessary to reproduce the bug, including your gem version, Ruby version, and
37
+ operating system. Ideally, a bug report should include a pull request with failing specs.
38
+
39
+
40
+ Submitting a Pull Request
41
+ -------------------------
42
+ 1. Fork the project.
43
+ 2. Create a topic branch.
44
+ 3. Implement your feature or bug fix.
45
+ 4. Add documentation for your feature or bug fix.
46
+ 5. Run <tt>rake doc:yard</tt>. If your changes are not 100% documented, go back to step 4.
47
+ 6. Add specs for your feature or bug fix.
48
+ 7. Run <tt>rake spec</tt>. If your changes are not 100% covered, go back to step 6.
49
+ 8. Commit and push your changes.
50
+ 9. Submit a pull request. Please do not include changes to the gemspec, version, or history file. (If you want to create your own version for some reason, please do so in a separate commit.)
51
+
52
+
53
+ Copyright
54
+ ---------
55
+ Copyright (c) 2013 K$.
56
+ See [LICENSE](https://github.com/kdmny/blackhole-mailer/blob/master/LICENSE.md) for details.
@@ -0,0 +1,27 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rspec/core/rake_task'
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task :default => :spec
8
+
9
+ namespace :doc do
10
+ begin
11
+ require 'yard'
12
+ rescue LoadError
13
+ # ignore
14
+ else
15
+ YARD::Rake::YardocTask.new do |task|
16
+ task.files = ['HISTORY.mkd', 'LICENSE.mkd', 'lib/**/*.rb']
17
+ task.options = [
18
+ '--protected',
19
+ '--output-dir', 'doc/yard',
20
+ '--tag', 'format:Supported formats',
21
+ '--tag', 'authenticated:Requires Authentication',
22
+ '--tag', 'rate_limited:Rate Limited',
23
+ '--markup', 'markdown',
24
+ ]
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/blackhole-mailer/version', __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.add_development_dependency('rspec', '~> 2.4')
6
+ s.add_development_dependency('bluecloth', '~> 2.0.11')
7
+ s.add_development_dependency('yard')
8
+ s.add_runtime_dependency('resque_mailer', '~> 2.1.0')
9
+ s.authors = ["K$"]
10
+ s.description = %q{A mail utility so dense, no message can escape.}
11
+ s.email = ['kdmny30@gmail.com']
12
+ s.files = `git ls-files`.split("\n")
13
+ s.homepage = 'https://github.com/kdmny/blackhole-mailer'
14
+ s.name = 'blackhole-mailer'
15
+ s.platform = Gem::Platform::RUBY
16
+ s.require_paths = ['lib']
17
+ s.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if s.respond_to? :required_rubygems_version=
18
+ s.rubyforge_project = s.name
19
+ s.summary = %q{A mail utility so dense, no message can escape.}
20
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
+ s.version = BlackHoleMailer::VERSION
22
+ end
@@ -0,0 +1,3 @@
1
+ require 'blackhole-mailer/black_hole_mailer'
2
+ require 'blackhole-mailer/base_mailer'
3
+ require 'blackhole-mailer/async_mailer'
@@ -0,0 +1,4 @@
1
+ # Adds resque_mailer methods to any subclass.
2
+ class AsyncMailer < BaseMailer
3
+ include Resque::Mailer
4
+ end
@@ -0,0 +1,17 @@
1
+ # Offers subclasses a hook to abort deliver of a mail message.
2
+ class BaseMailer < ActionMailer::Base
3
+
4
+ class AbortDeliveryError < StandardError;end;
5
+
6
+ def abort_delivery
7
+ raise AbortDeliveryError
8
+ end
9
+
10
+ def process(*args)
11
+ begin
12
+ super *args
13
+ rescue AbortDeliveryError
14
+ self.message = BlackholeMailMessage
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,6 @@
1
+ # A mail message that self destructs.
2
+ class BlackholeMailMessage < Mail::Message
3
+ def self.deliver
4
+ false
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ module BlackHoleMailer
2
+ VERSION = '0.0.1'
3
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: blackhole-mailer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - K$
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-18 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &70365208959960 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '2.4'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70365208959960
25
+ - !ruby/object:Gem::Dependency
26
+ name: bluecloth
27
+ requirement: &70365208936360 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 2.0.11
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70365208936360
36
+ - !ruby/object:Gem::Dependency
37
+ name: yard
38
+ requirement: &70365208935860 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70365208935860
47
+ - !ruby/object:Gem::Dependency
48
+ name: resque_mailer
49
+ requirement: &70365208935260 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 2.1.0
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *70365208935260
58
+ description: A mail utility so dense, no message can escape.
59
+ email:
60
+ - kdmny30@gmail.com
61
+ executables: []
62
+ extensions: []
63
+ extra_rdoc_files: []
64
+ files:
65
+ - .gitignore
66
+ - Gemfile
67
+ - Gemfile.lock
68
+ - LICENSE.md
69
+ - README.md
70
+ - Rakefile
71
+ - blackhole-mailer.gemspec
72
+ - lib/blackhole-mailer.rb
73
+ - lib/blackhole-mailer/async_mailer.rb
74
+ - lib/blackhole-mailer/base_mailer.rb
75
+ - lib/blackhole-mailer/black_hole_mailer.rb
76
+ - lib/blackhole-mailer/version.rb
77
+ homepage: https://github.com/kdmny/blackhole-mailer
78
+ licenses: []
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: 1.3.6
95
+ requirements: []
96
+ rubyforge_project: blackhole-mailer
97
+ rubygems_version: 1.8.15
98
+ signing_key:
99
+ specification_version: 3
100
+ summary: A mail utility so dense, no message can escape.
101
+ test_files: []
102
+ has_rdoc: