smailer 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,19 @@
|
|
1
|
+
class SmailerMigrationGenerator < Rails::Generators::Base
|
2
|
+
desc "This generator creates a migration file containing definitions of the tables needed to run Smailer."
|
3
|
+
|
4
|
+
def create_migration_file
|
5
|
+
root = File.dirname(__FILE__)
|
6
|
+
source = File.expand_path 'templates/migration.rb', root
|
7
|
+
destination = Rails.root.join("db/migrate/#{next_migration_number}_create_smailer_tables.rb")
|
8
|
+
|
9
|
+
FileUtils.cp source, destination
|
10
|
+
|
11
|
+
puts "Created #{destination}"
|
12
|
+
end
|
13
|
+
|
14
|
+
protected
|
15
|
+
|
16
|
+
def next_migration_number
|
17
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
class CreateSmailerProperties < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table "mailing_lists", :force => true do |t|
|
4
|
+
t.string "name"
|
5
|
+
t.datetime "created_at"
|
6
|
+
t.datetime "updated_at"
|
7
|
+
end
|
8
|
+
|
9
|
+
create_table "mail_campaigns", :force => true do |t|
|
10
|
+
t.integer "mailing_list_id"
|
11
|
+
t.string "from"
|
12
|
+
t.string "subject"
|
13
|
+
t.text "body_html"
|
14
|
+
t.integer "unsubscribe_methods"
|
15
|
+
t.datetime "created_at"
|
16
|
+
t.datetime "updated_at"
|
17
|
+
t.text "body_text"
|
18
|
+
t.integer "sent_mails_count", :default => 0, :null => false
|
19
|
+
t.integer "opened_mails_count", :default => 0, :null => false
|
20
|
+
end
|
21
|
+
add_index "mail_campaigns", ["mailing_list_id"], :name => "index_mail_campaigns_on_mailing_list_id"
|
22
|
+
|
23
|
+
create_table "queued_mails", :force => true do |t|
|
24
|
+
t.integer "mail_campaign_id"
|
25
|
+
t.string "to"
|
26
|
+
t.integer "retries", :default => 0, :null => false
|
27
|
+
t.datetime "last_retry_at"
|
28
|
+
t.string "last_error"
|
29
|
+
t.datetime "created_at"
|
30
|
+
t.datetime "updated_at"
|
31
|
+
t.string "key"
|
32
|
+
end
|
33
|
+
add_index "queued_mails", ["mail_campaign_id", "to"], :name => "index_queued_mails_on_mail_campain_id_and_to", :unique => true
|
34
|
+
add_index "queued_mails", ["retries"], :name => "index_queued_mails_on_retries"
|
35
|
+
|
36
|
+
create_table "finished_mails", :force => true do |t|
|
37
|
+
t.integer "mail_campaign_id"
|
38
|
+
t.string "from"
|
39
|
+
t.string "to"
|
40
|
+
t.string "subject"
|
41
|
+
t.text "body_html"
|
42
|
+
t.integer "retries"
|
43
|
+
t.datetime "last_retry_at"
|
44
|
+
t.string "last_error"
|
45
|
+
t.datetime "sent_at"
|
46
|
+
t.integer "status"
|
47
|
+
t.datetime "created_at"
|
48
|
+
t.datetime "updated_at"
|
49
|
+
t.text "body_text"
|
50
|
+
t.boolean "opened", :default => false, :null => false
|
51
|
+
t.string "key"
|
52
|
+
end
|
53
|
+
add_index "finished_mails", ["key"], :name => "index_finished_mails_on_key", :unique => true
|
54
|
+
add_index "finished_mails", ["mail_campaign_id", "status"], :name => "index_finished_mails_on_mail_campain_id_and_status"
|
55
|
+
add_index "finished_mails", ["to", "mail_campaign_id"], :name => "index_finished_mails_on_to_and_mail_campaign_id"
|
56
|
+
|
57
|
+
create_table "mail_keys", :force => true do |t|
|
58
|
+
t.string "email"
|
59
|
+
t.string "key"
|
60
|
+
t.datetime "created_at"
|
61
|
+
t.datetime "updated_at"
|
62
|
+
end
|
63
|
+
add_index "mail_keys", ["email"], :name => "index_mail_keys_on_email", :unique => true
|
64
|
+
add_index "mail_keys", ["key"], :name => "index_mail_keys_on_key", :unique => true
|
65
|
+
|
66
|
+
create_table "smailer_properties", :force => true do |t|
|
67
|
+
t.string "name"
|
68
|
+
t.text "value"
|
69
|
+
t.datetime "created_at"
|
70
|
+
t.datetime "updated_at"
|
71
|
+
t.string "notes"
|
72
|
+
end
|
73
|
+
add_index "smailer_properties", ["name"], :name => "index_smailer_properties_on_name", :unique => true
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.down
|
77
|
+
drop_table :smailer_properties
|
78
|
+
|
79
|
+
remove_index :mail_keys, :name => "index_mail_keys_on_email"
|
80
|
+
remove_index :mail_keys, :name => "index_mail_keys_on_email"
|
81
|
+
drop_table :mail_keys
|
82
|
+
|
83
|
+
remove_index :finished_mails, :name => "index_finished_mails_on_key"
|
84
|
+
remove_index :finished_mails, :name => "index_finished_mails_on_mail_campain_id_and_status"
|
85
|
+
remove_index :finished_mails, :name => "index_finished_mails_on_to_and_mail_campaign_id"
|
86
|
+
drop_table :finished_mails
|
87
|
+
|
88
|
+
remove_index :queued_mails, :name => "index_queued_mails_on_mail_campain_id_and_to"
|
89
|
+
remove_index :queued_mails, :name => "index_queued_mails_on_retries"
|
90
|
+
drop_table :queued_mails
|
91
|
+
|
92
|
+
remove_index :mail_campaigns, :name => "index_mail_campaigns_on_mailing_list_id"
|
93
|
+
drop_table :mail_campaigns
|
94
|
+
|
95
|
+
drop_table :mailing_lists
|
96
|
+
end
|
97
|
+
end
|
data/lib/smailer/version.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 21
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Dimitar Dimitrov
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2011-09-
|
18
|
+
date: 2011-09-13 00:00:00 +03:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: bundler
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 23
|
27
30
|
segments:
|
28
31
|
- 1
|
29
32
|
- 0
|
@@ -45,6 +48,8 @@ files:
|
|
45
48
|
- Gemfile
|
46
49
|
- README.md
|
47
50
|
- Rakefile
|
51
|
+
- lib/generators/smailer_migration/smailer_migration_generator.rb
|
52
|
+
- lib/generators/smailer_migration/templates/migration.rb
|
48
53
|
- lib/smailer.rb
|
49
54
|
- lib/smailer/compatibility.rb
|
50
55
|
- lib/smailer/models.rb
|
@@ -68,16 +73,20 @@ rdoc_options: []
|
|
68
73
|
require_paths:
|
69
74
|
- lib
|
70
75
|
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
71
77
|
requirements:
|
72
78
|
- - ">="
|
73
79
|
- !ruby/object:Gem::Version
|
80
|
+
hash: 3
|
74
81
|
segments:
|
75
82
|
- 0
|
76
83
|
version: "0"
|
77
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
78
86
|
requirements:
|
79
87
|
- - ">="
|
80
88
|
- !ruby/object:Gem::Version
|
89
|
+
hash: 23
|
81
90
|
segments:
|
82
91
|
- 1
|
83
92
|
- 3
|
@@ -86,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
95
|
requirements: []
|
87
96
|
|
88
97
|
rubyforge_project: smailer
|
89
|
-
rubygems_version: 1.
|
98
|
+
rubygems_version: 1.6.2
|
90
99
|
signing_key:
|
91
100
|
specification_version: 3
|
92
101
|
summary: A simple newsletter mailer for Rails.
|