growl_mailer 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/Gemfile +4 -0
- data/Rakefile +2 -0
- data/growl_mailer.gemspec +23 -0
- data/lib/growl_mailer.rb +34 -0
- data/lib/growl_mailer/version.rb +3 -0
- metadata +86 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "growl_mailer/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "growl_mailer"
|
7
|
+
s.version = GrowlMailer::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Michael Deering"]
|
10
|
+
s.email = ["mdeering@mdeering.com"]
|
11
|
+
s.homepage = "http://rubygems.org/gems/growl_mailer"
|
12
|
+
s.summary = %q{Will Growl Message Deliveries}
|
13
|
+
s.description = %q{Will Growl Message Deliveries}
|
14
|
+
|
15
|
+
s.rubyforge_project = "growl_mailer"
|
16
|
+
|
17
|
+
s.add_runtime_dependency 'growl'
|
18
|
+
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
end
|
data/lib/growl_mailer.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
module Mail
|
2
|
+
# The GrowlMailer is a bare bones mailer that does nothing but use Growl Notify to alert
|
3
|
+
# to the fact a messages delivery attempt has happend
|
4
|
+
class GrowlMailer
|
5
|
+
require 'growl'
|
6
|
+
|
7
|
+
attr_accessor :settings
|
8
|
+
|
9
|
+
def initialize(values)
|
10
|
+
puts values.inspect
|
11
|
+
self.settings = {
|
12
|
+
:icon => 'Mail',
|
13
|
+
:message => lambda { |mail| mail.subject },
|
14
|
+
:title => lambda { |mail| mail.destinations.join(", ") }
|
15
|
+
}.merge!(values)
|
16
|
+
end
|
17
|
+
|
18
|
+
def deliver!(mail)
|
19
|
+
options = options(mail)
|
20
|
+
Growl.notify options.delete(:message), options
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def options(mail)
|
26
|
+
{}.tap do |options|
|
27
|
+
settings.each_pair { |key, value| options[key] = value.respond_to?(:call) ? value.call(mail) : value }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
ActionMailer::Base.add_delivery_method(:growl, Mail::GrowlMailer) if defined?(ActionMailer::Base)
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: growl_mailer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Michael Deering
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-10-29 00:00:00 -06:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: growl
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
description: Will Growl Message Deliveries
|
36
|
+
email:
|
37
|
+
- mdeering@mdeering.com
|
38
|
+
executables: []
|
39
|
+
|
40
|
+
extensions: []
|
41
|
+
|
42
|
+
extra_rdoc_files: []
|
43
|
+
|
44
|
+
files:
|
45
|
+
- .gitignore
|
46
|
+
- Gemfile
|
47
|
+
- Rakefile
|
48
|
+
- growl_mailer.gemspec
|
49
|
+
- lib/growl_mailer.rb
|
50
|
+
- lib/growl_mailer/version.rb
|
51
|
+
has_rdoc: true
|
52
|
+
homepage: http://rubygems.org/gems/growl_mailer
|
53
|
+
licenses: []
|
54
|
+
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options: []
|
57
|
+
|
58
|
+
require_paths:
|
59
|
+
- lib
|
60
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
hash: 3
|
66
|
+
segments:
|
67
|
+
- 0
|
68
|
+
version: "0"
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
version: "0"
|
78
|
+
requirements: []
|
79
|
+
|
80
|
+
rubyforge_project: growl_mailer
|
81
|
+
rubygems_version: 1.3.7
|
82
|
+
signing_key:
|
83
|
+
specification_version: 3
|
84
|
+
summary: Will Growl Message Deliveries
|
85
|
+
test_files: []
|
86
|
+
|