mailbag 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.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in mailbag.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,20 @@
1
+ # mailbag
2
+
3
+ This gem logs email sent by a Rails application to a database table.
4
+
5
+ ### Installation
6
+
7
+ In your Gemfile, add this line:
8
+
9
+ gem "mailbag"
10
+
11
+ Then, run `bundle install`.
12
+
13
+ Run the generator and migrate:
14
+
15
+ rails g mailbag
16
+ rake db:migrate
17
+
18
+ ### Usage
19
+
20
+ You don't have to do anything. Any mail sent out by ActionMailer will be logged to the email_logs table. EmailLog is a standard ActiveRecord model that you can use to interact with your email log.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,7 @@
1
+ class MailbagLogger
2
+ def self.delivered_email(message)
3
+ EmailLog.create(:to => message.to.to_s, :from => message.from.to_s, :subject => message.subject, :body => message.body.to_s)
4
+ end
5
+ end
6
+
7
+ Mail.register_observer(MailbagLogger)
@@ -0,0 +1,13 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/active_record'
3
+
4
+ class MailbagGenerator < Rails::Generators::Base
5
+ include Rails::Generators::Migration
6
+ extend ActiveRecord::Generators::Migration
7
+
8
+ source_root File.expand_path('../templates', __FILE__)
9
+
10
+ def copy_files(*args)
11
+ migration_template 'create_email_logs.rb', 'db/migrate/create_email_logs.rb'
12
+ end
13
+ end
@@ -0,0 +1,18 @@
1
+ class CreateEmailLogs < ActiveRecord::Migration
2
+ def up
3
+ create_table :email_logs do |t|
4
+ t.string :to
5
+ t.string :from
6
+ t.string :subject
7
+ t.text :body
8
+ t.datetime :created_at
9
+ end
10
+
11
+ add_index :email_logs, :to
12
+ add_index :email_logs, :from
13
+ end
14
+
15
+ def down
16
+ drop_table :email_logs
17
+ end
18
+ end
@@ -0,0 +1,6 @@
1
+ module Mailbag
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Mailbag
2
+ module Rails
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require 'mailbag/rails/engine'
2
+ require 'mailbag/rails/version'
data/lib/mailbag.rb ADDED
@@ -0,0 +1 @@
1
+ require "mailbag/rails"
data/mailbag.gemspec ADDED
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "mailbag/rails/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "mailbag"
7
+ s.version = Mailbag::Rails::VERSION
8
+ s.authors = ["John Colvin"]
9
+ s.email = ["colvin.john@gmail.com"]
10
+ s.homepage = "https://github.com/JohnColvin/mailbag"
11
+ s.summary = %q{Rails gem that logs outgoing mail to a database table}
12
+ s.description = %q{Mailbag keeps track of the emails that your application sends out by logging them to a database table}
13
+
14
+ s.rubyforge_project = "mailbag"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency "actionmailer", "~> 3.2.1"
22
+ end
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mailbag
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - John Colvin
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2012-02-20 00:00:00 -05:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: actionmailer
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 3
30
+ - 2
31
+ - 1
32
+ version: 3.2.1
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ description: Mailbag keeps track of the emails that your application sends out by logging them to a database table
36
+ email:
37
+ - colvin.john@gmail.com
38
+ executables: []
39
+
40
+ extensions: []
41
+
42
+ extra_rdoc_files: []
43
+
44
+ files:
45
+ - .gitignore
46
+ - Gemfile
47
+ - README.md
48
+ - Rakefile
49
+ - config/initializers/mailbag.rb
50
+ - lib/generators/mailbag_generator.rb
51
+ - lib/generators/templates/create_email_logs.rb
52
+ - lib/mailbag.rb
53
+ - lib/mailbag/rails.rb
54
+ - lib/mailbag/rails/engine.rb
55
+ - lib/mailbag/rails/version.rb
56
+ - mailbag.gemspec
57
+ has_rdoc: true
58
+ homepage: https://github.com/JohnColvin/mailbag
59
+ licenses: []
60
+
61
+ post_install_message:
62
+ rdoc_options: []
63
+
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ segments:
72
+ - 0
73
+ version: "0"
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ segments:
80
+ - 0
81
+ version: "0"
82
+ requirements: []
83
+
84
+ rubyforge_project: mailbag
85
+ rubygems_version: 1.3.7
86
+ signing_key:
87
+ specification_version: 3
88
+ summary: Rails gem that logs outgoing mail to a database table
89
+ test_files: []
90
+