mirror of
https://github.com/moparisthebest/mailcatcher
synced 2024-12-22 07:18:53 -05:00
Add --sqlite-db option to allow for persistant storage
This commit is contained in:
parent
fb91dd0902
commit
d42f2bf11d
@ -80,6 +80,7 @@ module MailCatcher extend self
|
||||
:daemon => !windows?,
|
||||
:browse => false,
|
||||
:quit => true,
|
||||
:sqlite_db => ':memory:',
|
||||
}
|
||||
|
||||
def options
|
||||
@ -120,6 +121,10 @@ module MailCatcher extend self
|
||||
options[:quit] = false
|
||||
end
|
||||
|
||||
parser.on("--sqlite-db PATH", "Set the path to the sqlite database, default in-memory only") do |db|
|
||||
options[:sqlite_db] = db
|
||||
end
|
||||
|
||||
if mac?
|
||||
parser.on("--[no-]growl") do |growl|
|
||||
puts "Growl is no longer supported"
|
||||
|
@ -6,9 +6,9 @@ require "sqlite3"
|
||||
module MailCatcher::Mail extend self
|
||||
def db
|
||||
@__db ||= begin
|
||||
SQLite3::Database.new(":memory:", :type_translation => true).tap do |db|
|
||||
SQLite3::Database.new(MailCatcher.options[:sqlite_db], :type_translation => true).tap do |db|
|
||||
db.execute(<<-SQL)
|
||||
CREATE TABLE message (
|
||||
CREATE TABLE IF NOT EXISTS message (
|
||||
id INTEGER PRIMARY KEY ASC,
|
||||
sender TEXT,
|
||||
recipients TEXT,
|
||||
@ -20,7 +20,7 @@ module MailCatcher::Mail extend self
|
||||
)
|
||||
SQL
|
||||
db.execute(<<-SQL)
|
||||
CREATE TABLE message_part (
|
||||
CREATE TABLE IF NOT EXISTS message_part (
|
||||
id INTEGER PRIMARY KEY ASC,
|
||||
message_id INTEGER NOT NULL,
|
||||
cid TEXT,
|
||||
|
Loading…
Reference in New Issue
Block a user