jqr-railmail 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +7 -0
- data/README.rdoc +39 -0
- data/VERSION.yml +4 -0
- data/generators/railmail_migration/USAGE +15 -0
- data/generators/railmail_migration/railmail_migration_generator.rb +12 -0
- data/generators/railmail_migration/templates/migration.rb +16 -0
- data/lib/railmail.rb +20 -0
- data/lib/railmail/action_mailer.rb +26 -0
- data/test/railmail_test.rb +8 -0
- metadata +66 -0
data/LICENSE
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright (c) 2006 Scott Fleckenstein
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
= Railmail
|
2
|
+
|
3
|
+
Railmail allows email to be delivered and inspected in development mode
|
4
|
+
without the use of a mail server.
|
5
|
+
|
6
|
+
When Railmail is enabled, any mail sent by your application will be trapped
|
7
|
+
and stored in a database table. An interface is enabled within your
|
8
|
+
application where you can view these emails. With Railmail there is no need to
|
9
|
+
set up testing email accounts while developing your application; just send out
|
10
|
+
mail to any address and Railmail will capture it.
|
11
|
+
|
12
|
+
What it does
|
13
|
+
* Tracks email that your application sends
|
14
|
+
* Resends email with new recipients
|
15
|
+
* Helps you to develop applications that use ActionMailer with no need for an smtp or sendmail setup
|
16
|
+
* Saves the world
|
17
|
+
|
18
|
+
== Install
|
19
|
+
|
20
|
+
As a Rails plugin, add this to your development.rb and run the following commands.
|
21
|
+
|
22
|
+
ActionMailer::Base.delivery_method = :railmail
|
23
|
+
|
24
|
+
./script/plugin install git://github.com/jqr/railmail.git
|
25
|
+
$ rake railmail:migration db:migrate
|
26
|
+
|
27
|
+
Prefer gems? Add this to your development.rb and then run the following command.
|
28
|
+
|
29
|
+
config.gem 'jqr-railmail', :lib => 'railmail', :source => 'http://gems.github.com'
|
30
|
+
ActionMailer::Base.delivery_method = :railmail
|
31
|
+
|
32
|
+
$ rake gems:install railmail:migration db:migrate
|
33
|
+
|
34
|
+
== Usage
|
35
|
+
|
36
|
+
When your application is running and Railmail is configured correctly,
|
37
|
+
navigating to /railmail/ will bring you to the main interface. Also, you can
|
38
|
+
add your own custom routes that navigate to the railmail controller and put
|
39
|
+
the interface wherever you want in your URL scheme.
|
data/VERSION.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
Description:
|
2
|
+
The railmail table migration generator creates a migration for adding the railmail_deliveries table
|
3
|
+
used by Railmail.
|
4
|
+
|
5
|
+
The generator takes a migration name as its argument. The migration name may be
|
6
|
+
given in CamelCase or under_score.
|
7
|
+
|
8
|
+
The generator creates a migration class in db/migrate prefixed by its number
|
9
|
+
in the queue.
|
10
|
+
|
11
|
+
Example:
|
12
|
+
./script/generate railmail_migration AddRailmailTable
|
13
|
+
|
14
|
+
With 4 existing migrations, this will create an AddRailmailTable migration in the
|
15
|
+
file db/migrate/005_add_railmail_table.rb
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class RailmailMigrationGenerator < Rails::Generator::NamedBase
|
2
|
+
def initialize(runtime_args, runtime_options = {})
|
3
|
+
runtime_args << 'add_railmail_table' if runtime_args.empty?
|
4
|
+
super
|
5
|
+
end
|
6
|
+
|
7
|
+
def manifest
|
8
|
+
record do |m|
|
9
|
+
m.migration_template 'migration.rb', 'db/migrate'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class <%= class_name %> < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :railmail_deliveries do |t|
|
4
|
+
t.column "recipients", :string, :limit => 1.kilobyte
|
5
|
+
t.column "from", :string, :limit => 255
|
6
|
+
t.column "subject", :string, :limit => 1.kilobyte
|
7
|
+
t.column "sent_at", :datetime
|
8
|
+
t.column "read_at", :datetime
|
9
|
+
t.column "raw", :string, :limit => 10.megabytes
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
drop_table :railmail_deliveries
|
15
|
+
end
|
16
|
+
end
|
data/lib/railmail.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'will_paginate'
|
2
|
+
require 'railmail/action_mailer'
|
3
|
+
|
4
|
+
ActionMailer::Base.class_eval do
|
5
|
+
include Railmail::ActionMailer::InstanceMethods
|
6
|
+
end
|
7
|
+
|
8
|
+
module Railmail
|
9
|
+
def self.init(config, directory)
|
10
|
+
config.controller_paths << File.join(directory, 'app', 'controllers')
|
11
|
+
$LOAD_PATH << File.join(directory, 'app', 'controllers')
|
12
|
+
$LOAD_PATH << File.join(directory, 'app', 'models')
|
13
|
+
$LOAD_PATH << File.join(directory, 'app', 'helpers')
|
14
|
+
|
15
|
+
ActiveSupport::Dependencies.load_paths << File.join(directory, 'app', 'controllers')
|
16
|
+
ActiveSupport::Dependencies.load_paths << File.join(directory, 'app', 'models')
|
17
|
+
ActiveSupport::Dependencies.load_paths << File.join(directory, 'app', 'helpers')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Railmail
|
2
|
+
module ActionMailer
|
3
|
+
|
4
|
+
module InstanceMethods
|
5
|
+
@@railmail_settings = {}
|
6
|
+
mattr_accessor :railmail_settings
|
7
|
+
|
8
|
+
def perform_delivery_railmail(mail)
|
9
|
+
r = RailmailDelivery.new
|
10
|
+
|
11
|
+
r.recipients = mail.to
|
12
|
+
r.from = mail.from
|
13
|
+
r.subject = mail.subject
|
14
|
+
r.sent_at = Time.now
|
15
|
+
r.raw = mail
|
16
|
+
|
17
|
+
r.save!
|
18
|
+
|
19
|
+
if self.railmail_settings[:passthrough]
|
20
|
+
send("perform_delivery_#{self.railmail_settings[:passthrough]}", mail) if perform_deliveries
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jqr-railmail
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Scott Fleckenstein
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-04-02 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: When Railmail is enabled, any mail sent by your application will be trapped and stored in a database table. An interface is enabled within your application where you can view these emails. With railmail there is no need to set up testing email accounts while developing your application; just send out mail to any address and Railmail will capture it.
|
17
|
+
email:
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.rdoc
|
24
|
+
- LICENSE
|
25
|
+
files:
|
26
|
+
- README.rdoc
|
27
|
+
- VERSION.yml
|
28
|
+
- generators/railmail_migration
|
29
|
+
- generators/railmail_migration/railmail_migration_generator.rb
|
30
|
+
- generators/railmail_migration/templates
|
31
|
+
- generators/railmail_migration/templates/migration.rb
|
32
|
+
- generators/railmail_migration/USAGE
|
33
|
+
- lib/railmail
|
34
|
+
- lib/railmail/action_mailer.rb
|
35
|
+
- lib/railmail.rb
|
36
|
+
- test/railmail_test.rb
|
37
|
+
- LICENSE
|
38
|
+
has_rdoc: true
|
39
|
+
homepage: http://nullstyle.com/railmail/
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options:
|
42
|
+
- --inline-source
|
43
|
+
- --charset=UTF-8
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: "0"
|
51
|
+
version:
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
57
|
+
version:
|
58
|
+
requirements: []
|
59
|
+
|
60
|
+
rubyforge_project:
|
61
|
+
rubygems_version: 1.2.0
|
62
|
+
signing_key:
|
63
|
+
specification_version: 2
|
64
|
+
summary: Railmail allows email to be delivered and inspected in development mode without the use of a mail server.
|
65
|
+
test_files: []
|
66
|
+
|