mail_manager 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.
Files changed (197) hide show
  1. checksums.yaml +15 -0
  2. data/.DS_Store +0 -0
  3. data/.gitignore +20 -0
  4. data/.rspec +1 -0
  5. data/.ruby-gemset +1 -0
  6. data/.ruby-version +1 -0
  7. data/Gemfile +27 -0
  8. data/Guardfile +24 -0
  9. data/LICENSE.txt +22 -0
  10. data/MIT-LICENSE +20 -0
  11. data/Manifest.txt +141 -0
  12. data/Procfile +4 -0
  13. data/README +243 -0
  14. data/README.md +29 -0
  15. data/README.rdoc +3 -0
  16. data/Rakefile +33 -0
  17. data/app/.DS_Store +0 -0
  18. data/app/assets/javascripts/mail_manager/application.js +15 -0
  19. data/app/assets/stylesheets/mail_manager/application.css +13 -0
  20. data/app/controllers/mail_manager/application_controller.rb +4 -0
  21. data/app/controllers/mail_manager/base_controller.rb +22 -0
  22. data/app/controllers/mail_manager/bounces_controller.rb +32 -0
  23. data/app/controllers/mail_manager/contacts_controller.rb +75 -0
  24. data/app/controllers/mail_manager/mailing_lists_controller.rb +49 -0
  25. data/app/controllers/mail_manager/mailings_controller.rb +102 -0
  26. data/app/controllers/mail_manager/messages_controller.rb +30 -0
  27. data/app/controllers/mail_manager/subscriptions_controller.rb +104 -0
  28. data/app/helpers/mail_manager/application_helper.rb +4 -0
  29. data/app/helpers/mail_manager/subscriptions_helper.rb +8 -0
  30. data/app/models/.DS_Store +0 -0
  31. data/app/models/mail_manager.rb +12 -0
  32. data/app/models/mail_manager/bounce.rb +133 -0
  33. data/app/models/mail_manager/contact.rb +91 -0
  34. data/app/models/mail_manager/contactable_registry.rb +190 -0
  35. data/app/models/mail_manager/mailable_registry.rb +127 -0
  36. data/app/models/mail_manager/mailer.rb +267 -0
  37. data/app/models/mail_manager/mailing.rb +266 -0
  38. data/app/models/mail_manager/mailing_list.rb +36 -0
  39. data/app/models/mail_manager/message.rb +127 -0
  40. data/app/models/mail_manager/subscription.rb +126 -0
  41. data/app/models/mail_manager/test_message.rb +175 -0
  42. data/app/models/status_history.rb +60 -0
  43. data/app/views/layouts/mail_manager/application.html.erb +14 -0
  44. data/app/views/mail_manager/bounces/_email_parts.html.erb +30 -0
  45. data/app/views/mail_manager/bounces/index.html.erb +32 -0
  46. data/app/views/mail_manager/bounces/show.html.erb +38 -0
  47. data/app/views/mail_manager/contacts/_form.html.erb +27 -0
  48. data/app/views/mail_manager/contacts/double_opt_in.html.erb +1 -0
  49. data/app/views/mail_manager/contacts/edit.html.erb +12 -0
  50. data/app/views/mail_manager/contacts/index.html.erb +86 -0
  51. data/app/views/mail_manager/contacts/new.html.erb +9 -0
  52. data/app/views/mail_manager/contacts/show.html.erb +22 -0
  53. data/app/views/mail_manager/contacts/subscribe.html.erb +2 -0
  54. data/app/views/mail_manager/contacts/thank_you.html.erb +12 -0
  55. data/app/views/mail_manager/help/_available_email_substitutions.html.erb +5 -0
  56. data/app/views/mail_manager/mailer/double_opt_in.erb +6 -0
  57. data/app/views/mail_manager/mailer/unsubscribed.erb +5 -0
  58. data/app/views/mail_manager/mailer/unsubscribed.html.erb +5 -0
  59. data/app/views/mail_manager/mailing_lists/_form.html.erb +20 -0
  60. data/app/views/mail_manager/mailing_lists/edit.html.erb +13 -0
  61. data/app/views/mail_manager/mailing_lists/index.html.erb +39 -0
  62. data/app/views/mail_manager/mailing_lists/new.html.erb +9 -0
  63. data/app/views/mail_manager/mailing_lists/show.html.erb +13 -0
  64. data/app/views/mail_manager/mailings/_form.html.erb +81 -0
  65. data/app/views/mail_manager/mailings/edit.html.erb +12 -0
  66. data/app/views/mail_manager/mailings/index.html.erb +52 -0
  67. data/app/views/mail_manager/mailings/new.html.erb +9 -0
  68. data/app/views/mail_manager/mailings/show.html.erb +28 -0
  69. data/app/views/mail_manager/mailings/test.html.erb +12 -0
  70. data/app/views/mail_manager/messages/index.html.erb +37 -0
  71. data/app/views/mail_manager/subscriptions/_form.html.erb +37 -0
  72. data/app/views/mail_manager/subscriptions/_subscriptions.html.erb +13 -0
  73. data/app/views/mail_manager/subscriptions/edit.html.erb +11 -0
  74. data/app/views/mail_manager/subscriptions/index.html.erb +32 -0
  75. data/app/views/mail_manager/subscriptions/new.html.erb +9 -0
  76. data/app/views/mail_manager/subscriptions/show.html.erb +8 -0
  77. data/app/views/mail_manager/subscriptions/unsubscribe.html.erb +2 -0
  78. data/app/views/mail_manager/subscriptions/unsubscribe_by_email_address.html.erb +13 -0
  79. data/config/daemons.yml +5 -0
  80. data/config/routes.rb +43 -0
  81. data/db/migrate/001_mail_mgr_initial.rb +84 -0
  82. data/db/migrate/002_mail_mgr_create_contact.rb +60 -0
  83. data/db/migrate/003_mail_mgr_test_message.rb +23 -0
  84. data/db/migrate/004_add_deleted_at_to_mailing_lists.rb +15 -0
  85. data/db/migrate/005_contacts_deleted_at.rb +15 -0
  86. data/db/migrate/006_mail_mgr_mailing_list_add_defaults_to_active.rb +15 -0
  87. data/db/migrate/007_mail_mgr_message_add_from_email_address.rb +15 -0
  88. data/db/mlm_migrate/001_mlm_initial.rb +67 -0
  89. data/db/mlm_migrate/002_mailable_as_polymorphic.rb +27 -0
  90. data/db/mlm_migrate/003_contact_as_polymorphic.rb +64 -0
  91. data/db/mlm_migrate/004_bounce_mlm_mailing_id.rb +26 -0
  92. data/db/mlm_migrate/005_mlm_to_mail_mgr_scoped.rb +29 -0
  93. data/engine_plan.rb +13 -0
  94. data/features/bounce_management.feature +0 -0
  95. data/features/contact_management.feature +24 -0
  96. data/features/mailable.feature +23 -0
  97. data/features/mailing_management.feature +78 -0
  98. data/features/message.feature +11 -0
  99. data/features/step_definitions/email_steps.rb +50 -0
  100. data/features/step_definitions/mlm_steps.rb +11 -0
  101. data/features/step_definitions/pickle_steps.rb +41 -0
  102. data/features/step_definitions/webrat_steps.rb +115 -0
  103. data/features/subscription_management.feature +17 -0
  104. data/features/support/env.rb +31 -0
  105. data/features/support/paths.rb +44 -0
  106. data/lib/daemons/mail_manager.rb +38 -0
  107. data/lib/daemons/mail_manager_ctl +15 -0
  108. data/lib/deleteable.rb +50 -0
  109. data/lib/lock.rb +36 -0
  110. data/lib/mail_manager.rb +5 -0
  111. data/lib/mail_manager/config.rb +50 -0
  112. data/lib/mail_manager/engine.rb +43 -0
  113. data/lib/mail_manager/version.rb +3 -0
  114. data/lib/tasks/mail_manager.rake +143 -0
  115. data/lib/tasks/mail_manager_tasks.rake +4 -0
  116. data/lib/tasks/rspec.rake +165 -0
  117. data/lib/workers/mail_manager/bounce_job.rb +52 -0
  118. data/lib/workers/mail_manager/mailing_job.rb +30 -0
  119. data/lib/workers/mail_manager/message_job.rb +38 -0
  120. data/lib/workers/mail_manager/test_message_job.rb +37 -0
  121. data/mail_manager.gemspec +29 -0
  122. data/script/rails +8 -0
  123. data/spec/rcov.opts +2 -0
  124. data/spec/spec.opts +4 -0
  125. data/spec/spec_helper.rb +47 -0
  126. data/spec/test_app/README.rdoc +261 -0
  127. data/spec/test_app/Rakefile +7 -0
  128. data/spec/test_app/app/assets/javascripts/application.js +15 -0
  129. data/spec/test_app/app/assets/javascripts/users.js +2 -0
  130. data/spec/test_app/app/assets/stylesheets/application.css +13 -0
  131. data/spec/test_app/app/assets/stylesheets/scaffold.css +56 -0
  132. data/spec/test_app/app/assets/stylesheets/users.css +4 -0
  133. data/spec/test_app/app/controllers/application_controller.rb +3 -0
  134. data/spec/test_app/app/controllers/users_controller.rb +83 -0
  135. data/spec/test_app/app/helpers/application_helper.rb +2 -0
  136. data/spec/test_app/app/helpers/users_helper.rb +2 -0
  137. data/spec/test_app/app/models/user.rb +13 -0
  138. data/spec/test_app/app/views/layouts/application.html.erb +14 -0
  139. data/spec/test_app/app/views/users/_form.html.erb +33 -0
  140. data/spec/test_app/app/views/users/edit.html.erb +6 -0
  141. data/spec/test_app/app/views/users/index.html.erb +29 -0
  142. data/spec/test_app/app/views/users/new.html.erb +5 -0
  143. data/spec/test_app/app/views/users/show.html.erb +25 -0
  144. data/spec/test_app/config.ru +4 -0
  145. data/spec/test_app/config/application.rb +65 -0
  146. data/spec/test_app/config/boot.rb +10 -0
  147. data/spec/test_app/config/database.yml +25 -0
  148. data/spec/test_app/config/environment.rb +14 -0
  149. data/spec/test_app/config/environments/development.rb +37 -0
  150. data/spec/test_app/config/environments/production.rb +67 -0
  151. data/spec/test_app/config/environments/test.rb +37 -0
  152. data/spec/test_app/config/initializers/backtrace_silencers.rb +7 -0
  153. data/spec/test_app/config/initializers/inflections.rb +15 -0
  154. data/spec/test_app/config/initializers/mime_types.rb +5 -0
  155. data/spec/test_app/config/initializers/secret_token.rb +7 -0
  156. data/spec/test_app/config/initializers/session_store.rb +8 -0
  157. data/spec/test_app/config/initializers/wrap_parameters.rb +14 -0
  158. data/spec/test_app/config/locales/en.yml +5 -0
  159. data/spec/test_app/config/lockable.yml +3 -0
  160. data/spec/test_app/config/mail_manager.yml +21 -0
  161. data/spec/test_app/config/routes.rb +7 -0
  162. data/spec/test_app/db/migrate/20131217101010_create_users.rb +13 -0
  163. data/spec/test_app/db/migrate/20131221064151_mail_mgr_initial.rb +84 -0
  164. data/spec/test_app/db/migrate/20131221064152_mail_mgr_create_contact.rb +60 -0
  165. data/spec/test_app/db/migrate/20131221064153_mail_mgr_test_message.rb +23 -0
  166. data/spec/test_app/db/migrate/20131221064154_add_deleted_at_to_mailing_lists.rb +15 -0
  167. data/spec/test_app/db/migrate/20131221064155_contacts_deleted_at.rb +15 -0
  168. data/spec/test_app/db/migrate/20131221064156_mail_mgr_mailing_list_add_defaults_to_active.rb +15 -0
  169. data/spec/test_app/db/migrate/20131221064157_mail_mgr_message_add_from_email_address.rb +15 -0
  170. data/spec/test_app/db/migrate/20131221072600_create_delayed_jobs.rb +22 -0
  171. data/spec/test_app/db/schema.rb +131 -0
  172. data/spec/test_app/db/structure.sql +31 -0
  173. data/spec/test_app/public/404.html +26 -0
  174. data/spec/test_app/public/422.html +26 -0
  175. data/spec/test_app/public/500.html +25 -0
  176. data/spec/test_app/public/favicon.ico +0 -0
  177. data/spec/test_app/script/delayed_job +5 -0
  178. data/spec/test_app/script/lockable +36 -0
  179. data/spec/test_app/script/rails +6 -0
  180. data/spec/test_app/spec/controllers/users_controller_spec.rb +160 -0
  181. data/spec/test_app/spec/factories/mailing_lists.rb +7 -0
  182. data/spec/test_app/spec/factories/mailings.rb +6 -0
  183. data/spec/test_app/spec/factories/original_factories.rb.txt +107 -0
  184. data/spec/test_app/spec/factories/users.rb +10 -0
  185. data/spec/test_app/spec/models/mail_manager/bounce_spec.rb +17 -0
  186. data/spec/test_app/spec/models/mail_manager/mailing_list_spec.rb +15 -0
  187. data/spec/test_app/spec/models/user_spec.rb +37 -0
  188. data/spec/test_app/spec/requests/users_spec.rb +11 -0
  189. data/spec/test_app/spec/routing/users_routing_spec.rb +35 -0
  190. data/spec/test_app/spec/support/database_cleaner.rb +23 -0
  191. data/spec/test_app/spec/support/files/bad_utf8_chars.eml +32 -0
  192. data/spec/test_app/spec/views/users/edit.html.erb_spec.rb +24 -0
  193. data/spec/test_app/spec/views/users/index.html.erb_spec.rb +29 -0
  194. data/spec/test_app/spec/views/users/new.html.erb_spec.rb +24 -0
  195. data/spec/test_app/spec/views/users/show.html.erb_spec.rb +21 -0
  196. data/zeus.json +22 -0
  197. metadata +424 -0
@@ -0,0 +1,15 @@
1
+ class AddDeletedAtToMailingLists < ActiveRecord::Migration
2
+ def self.table_prefix
3
+ MailManager.table_prefix
4
+ rescue
5
+ 'mail_manager_'
6
+ end
7
+
8
+ def self.up
9
+ add_column :"#{table_prefix}mailing_lists", :deleted_at, :datetime
10
+ end
11
+
12
+ def self.down
13
+ remove_column :"#{table_prefix}mailing_lists", :deleted_at
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ class ContactsDeletedAt < ActiveRecord::Migration
2
+ def self.table_prefix
3
+ MailManager.table_prefix
4
+ rescue
5
+ 'mail_manager_'
6
+ end
7
+
8
+ def self.up
9
+ add_column :"#{table_prefix}contacts", :deleted_at, :datetime
10
+ end
11
+
12
+ def self.down
13
+ remove_column :"#{table_prefix}contacts", :deleted_at
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ class MailMgrMailingListAddDefaultsToActive < ActiveRecord::Migration
2
+ def self.table_prefix
3
+ MailManager.table_prefix
4
+ rescue
5
+ 'mail_manager_'
6
+ end
7
+
8
+ def self.up
9
+ add_column :"#{table_prefix}mailing_lists", :defaults_to_active, :boolean
10
+ end
11
+
12
+ def self.down
13
+ remove_column :"#{table_prefix}mailing_lists", :defaults_to_active
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ class MailMgrMessageAddFromEmailAddress < ActiveRecord::Migration
2
+ def self.table_prefix
3
+ MailManager.table_prefix
4
+ rescue
5
+ 'mail_manager_'
6
+ end
7
+
8
+ def self.up
9
+ add_column :"#{table_prefix}messages", :from_email_address, :string
10
+ end
11
+
12
+ def self.down
13
+ remove_column :"#{table_prefix}messages", :from_email_address
14
+ end
15
+ end
@@ -0,0 +1,22 @@
1
+ class CreateDelayedJobs < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :delayed_jobs, :force => true do |table|
4
+ table.integer :priority, :default => 0, :null => false # Allows some jobs to jump to the front of the queue
5
+ table.integer :attempts, :default => 0, :null => false # Provides for retries, but still fail eventually.
6
+ table.text :handler, :null => false # YAML-encoded string of the object that will do work
7
+ table.text :last_error # reason for last failure (See Note below)
8
+ table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
9
+ table.datetime :locked_at # Set when a client is working on this object
10
+ table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
11
+ table.string :locked_by # Who is working on this object (if locked)
12
+ table.string :queue # The name of the queue this job is in
13
+ table.timestamps
14
+ end
15
+
16
+ add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority'
17
+ end
18
+
19
+ def self.down
20
+ drop_table :delayed_jobs
21
+ end
22
+ end
@@ -0,0 +1,131 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20131221072600) do
15
+
16
+ create_table "delayed_jobs", :force => true do |t|
17
+ t.integer "priority", :default => 0, :null => false
18
+ t.integer "attempts", :default => 0, :null => false
19
+ t.text "handler", :null => false
20
+ t.text "last_error"
21
+ t.datetime "run_at"
22
+ t.datetime "locked_at"
23
+ t.datetime "failed_at"
24
+ t.string "locked_by"
25
+ t.string "queue"
26
+ t.datetime "created_at", :null => false
27
+ t.datetime "updated_at", :null => false
28
+ end
29
+
30
+ add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
31
+
32
+ create_table "mail_manager_bounces", :force => true do |t|
33
+ t.integer "message_id"
34
+ t.integer "mailing_id"
35
+ t.string "status"
36
+ t.datetime "status_changed_at"
37
+ t.text "bounce_message"
38
+ t.text "comments"
39
+ t.datetime "created_at", :null => false
40
+ t.datetime "updated_at", :null => false
41
+ end
42
+
43
+ create_table "mail_manager_contacts", :force => true do |t|
44
+ t.integer "contactable_id"
45
+ t.string "contactable_type"
46
+ t.string "email_address"
47
+ t.string "first_name"
48
+ t.string "last_name"
49
+ t.integer "upated_by"
50
+ t.integer "created_by"
51
+ t.datetime "created_at", :null => false
52
+ t.datetime "updated_at", :null => false
53
+ t.datetime "deleted_at"
54
+ end
55
+
56
+ create_table "mail_manager_mailables", :force => true do |t|
57
+ t.string "name", :null => false
58
+ t.text "email_html"
59
+ t.text "email_text"
60
+ t.boolean "reusable"
61
+ t.integer "updated_by"
62
+ t.datetime "created_at", :null => false
63
+ t.datetime "updated_at", :null => false
64
+ end
65
+
66
+ create_table "mail_manager_mailing_lists", :force => true do |t|
67
+ t.string "name"
68
+ t.text "description"
69
+ t.string "status"
70
+ t.datetime "status_changed_at"
71
+ t.datetime "created_at", :null => false
72
+ t.datetime "updated_at", :null => false
73
+ t.datetime "deleted_at"
74
+ t.boolean "defaults_to_active"
75
+ end
76
+
77
+ create_table "mail_manager_mailing_lists_mail_manager_mailings", :id => false, :force => true do |t|
78
+ t.integer "mailing_id"
79
+ t.integer "mailing_list_id"
80
+ end
81
+
82
+ create_table "mail_manager_mailings", :force => true do |t|
83
+ t.string "subject"
84
+ t.string "from_email_address"
85
+ t.string "mailable_type"
86
+ t.integer "mailable_id"
87
+ t.string "status"
88
+ t.datetime "status_changed_at"
89
+ t.datetime "scheduled_at"
90
+ t.boolean "include_images"
91
+ t.datetime "created_at", :null => false
92
+ t.datetime "updated_at", :null => false
93
+ end
94
+
95
+ create_table "mail_manager_messages", :force => true do |t|
96
+ t.string "type"
97
+ t.string "test_email_address"
98
+ t.integer "subscription_id"
99
+ t.integer "mailing_id"
100
+ t.string "guid"
101
+ t.string "status"
102
+ t.datetime "status_changed_at"
103
+ t.text "result"
104
+ t.datetime "created_at", :null => false
105
+ t.datetime "updated_at", :null => false
106
+ t.integer "contact_id"
107
+ t.string "from_email_address"
108
+ end
109
+
110
+ create_table "mail_manager_subscriptions", :force => true do |t|
111
+ t.integer "mailing_list_id"
112
+ t.string "status"
113
+ t.datetime "status_changed_at"
114
+ t.integer "updated_by"
115
+ t.datetime "created_at", :null => false
116
+ t.datetime "updated_at", :null => false
117
+ t.integer "contact_id"
118
+ end
119
+
120
+ create_table "users", :force => true do |t|
121
+ t.string "first_name"
122
+ t.string "last_name"
123
+ t.string "email"
124
+ t.string "phone"
125
+ t.datetime "created_at", :null => false
126
+ t.datetime "updated_at", :null => false
127
+ end
128
+
129
+ add_index "users", ["email"], :name => "index_users_on_email", :unique => true
130
+
131
+ end
@@ -0,0 +1,31 @@
1
+ CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL);
2
+ CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version");
3
+ CREATE TABLE "delayed_jobs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "priority" integer DEFAULT 0 NOT NULL, "attempts" integer DEFAULT 0 NOT NULL, "handler" text NOT NULL, "last_error" text, "run_at" datetime, "locked_at" datetime, "failed_at" datetime, "locked_by" varchar(255), "queue" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL);
4
+ CREATE INDEX "delayed_jobs_priority" ON "delayed_jobs" ("priority", "run_at");
5
+ CREATE TABLE "mail_manager_bounces" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "message_id" integer, "mailing_id" integer, "status" varchar(255), "status_changed_at" datetime, "bounce_message" text, "comments" text, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL);
6
+ CREATE TABLE "mail_manager_contacts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "contactable_id" integer, "contactable_type" varchar(255), "email_address" varchar(255), "first_name" varchar(255), "last_name" varchar(255), "upated_by" integer, "created_by" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "deleted_at" datetime);
7
+ CREATE TABLE "mail_manager_mailables" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL, "email_html" text, "email_text" text, "reusable" boolean, "updated_by" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL);
8
+ CREATE TABLE "mail_manager_mailing_lists" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "description" text, "status" varchar(255), "status_changed_at" datetime, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "deleted_at" datetime, "defaults_to_active" boolean);
9
+ CREATE TABLE "mail_manager_mailing_lists_mail_manager_mailings" ("mailing_id" integer, "mailing_list_id" integer);
10
+ CREATE TABLE "mail_manager_mailings" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "subject" varchar(255), "from_email_address" varchar(255), "mailable_type" varchar(255), "mailable_id" integer, "status" varchar(255), "status_changed_at" datetime, "scheduled_at" datetime, "include_images" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL);
11
+ CREATE TABLE "mail_manager_messages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar(255), "test_email_address" varchar(255), "subscription_id" integer, "mailing_id" integer, "guid" varchar(255), "status" varchar(255), "status_changed_at" datetime, "result" text, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "contact_id" integer, "from_email_address" varchar(255));
12
+ CREATE TABLE "mail_manager_subscriptions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "mailing_list_id" integer, "status" varchar(255), "status_changed_at" datetime, "updated_by" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "contact_id" integer);
13
+ CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "first_name" varchar(255), "last_name" varchar(255), "email" varchar(255), "phone" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL);
14
+ CREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email");
15
+ INSERT INTO schema_migrations (version) VALUES ('20131217101010');
16
+
17
+ INSERT INTO schema_migrations (version) VALUES ('20131221064151');
18
+
19
+ INSERT INTO schema_migrations (version) VALUES ('20131221064152');
20
+
21
+ INSERT INTO schema_migrations (version) VALUES ('20131221064153');
22
+
23
+ INSERT INTO schema_migrations (version) VALUES ('20131221064154');
24
+
25
+ INSERT INTO schema_migrations (version) VALUES ('20131221064155');
26
+
27
+ INSERT INTO schema_migrations (version) VALUES ('20131221064156');
28
+
29
+ INSERT INTO schema_migrations (version) VALUES ('20131221064157');
30
+
31
+ INSERT INTO schema_migrations (version) VALUES ('20131221072600');
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
4
+ require 'delayed/command'
5
+ Delayed::Command.new(ARGV).daemonize
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- encoding: utf-8 -*-
3
+
4
+ require "rubygems"
5
+ require "bundler"
6
+ Bundler.setup
7
+
8
+ FileUtils.mkdir_p('tmp/pids') unless File.exists?('tmp/pids')
9
+
10
+ require 'lockable'
11
+ if ARGV.include?('start')
12
+ begin
13
+ locker = Lockable::Client.locker
14
+ rescue Lockable::LockException => e
15
+ puts "Starting Lockable on #{Lockable::Server::url}!"
16
+ Lockable::Server::start_service
17
+ locker = Lockable::Client.locker
18
+ end
19
+ puts "Clearing Lockable locks!"
20
+ locker = Lockable::Client.locker
21
+ locker.locks.each_pair do |lock,data|
22
+ pid = data[:owner].split('|').last
23
+ if locker.running?(pid) || !data[:owner].include?(`hostname`.strip)
24
+ puts "Running - pid"
25
+ else
26
+ puts "Not Running - pid"
27
+ locker.release(data[:owner],lock)
28
+ end
29
+ end
30
+ elsif ARGV.include?('stop')
31
+ puts "Stopping Lockable!"
32
+ Lockable::Server::stop_service
33
+ elsif ARGV.include?('run')
34
+ puts "Running Lockable!"
35
+ Lockable::Server::run_service
36
+ end
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,160 @@
1
+ require 'spec_helper'
2
+
3
+ # This spec was generated by rspec-rails when you ran the scaffold generator.
4
+ # It demonstrates how one might use RSpec to specify the controller code that
5
+ # was generated by Rails when you ran the scaffold generator.
6
+ #
7
+ # It assumes that the implementation code is generated by the rails scaffold
8
+ # generator. If you are using any extension libraries to generate different
9
+ # controller code, this generated spec may or may not pass.
10
+ #
11
+ # It only uses APIs available in rails and/or rspec-rails. There are a number
12
+ # of tools you can use to make these specs even more expressive, but we're
13
+ # sticking to rails and rspec-rails APIs to keep things simple and stable.
14
+ #
15
+ # Compared to earlier versions of this generator, there is very limited use of
16
+ # stubs and message expectations in this spec. Stubs are only used when there
17
+ # is no simpler way to get a handle on the object needed for the example.
18
+ # Message expectations are only used when there is no simpler way to specify
19
+ # that an instance is receiving a specific message.
20
+
21
+ describe UsersController do
22
+
23
+ # This should return the minimal set of attributes required to create a valid
24
+ # User. As you add validations to User, be sure to
25
+ # adjust the attributes here as well.
26
+ let(:valid_attributes) { FactoryGirl.attributes_for(:user) }
27
+
28
+ # This should return the minimal set of values that should be in the session
29
+ # in order to pass any filters (e.g. authentication) defined in
30
+ # UsersController. Be sure to keep this updated too.
31
+ let(:valid_session) { {} }
32
+
33
+ describe "GET index" do
34
+ it "assigns all users as @users" do
35
+ user = User.create! valid_attributes
36
+ get :index, {}, valid_session
37
+ assigns(:users).should eq([user])
38
+ end
39
+ end
40
+
41
+ describe "GET show" do
42
+ it "assigns the requested user as @user" do
43
+ user = User.create! valid_attributes
44
+ get :show, {:id => user.to_param}, valid_session
45
+ assigns(:user).should eq(user)
46
+ end
47
+ end
48
+
49
+ describe "GET new" do
50
+ it "assigns a new user as @user" do
51
+ get :new, {}, valid_session
52
+ assigns(:user).should be_a_new(User)
53
+ end
54
+ end
55
+
56
+ describe "GET edit" do
57
+ it "assigns the requested user as @user" do
58
+ user = User.create! valid_attributes
59
+ get :edit, {:id => user.to_param}, valid_session
60
+ assigns(:user).should eq(user)
61
+ end
62
+ end
63
+
64
+ describe "POST create" do
65
+ describe "with valid params" do
66
+ it "creates a new User" do
67
+ expect {
68
+ post :create, {:user => valid_attributes}, valid_session
69
+ }.to change(User, :count).by(1)
70
+ end
71
+
72
+ it "assigns a newly created user as @user" do
73
+ post :create, {:user => valid_attributes}, valid_session
74
+ assigns(:user).should be_a(User)
75
+ assigns(:user).should be_persisted
76
+ end
77
+
78
+ it "redirects to the created user" do
79
+ post :create, {:user => valid_attributes}, valid_session
80
+ response.should redirect_to(User.last)
81
+ end
82
+ end
83
+
84
+ describe "with invalid params" do
85
+ it "assigns a newly created but unsaved user as @user" do
86
+ # Trigger the behavior that occurs when invalid params are submitted
87
+ User.any_instance.stub(:save).and_return(false)
88
+ post :create, {:user => { "first_name" => "invalid value" }}, valid_session
89
+ assigns(:user).should be_a_new(User)
90
+ end
91
+
92
+ it "re-renders the 'new' template" do
93
+ # Trigger the behavior that occurs when invalid params are submitted
94
+ User.any_instance.stub(:save).and_return(false)
95
+ post :create, {:user => { "first_name" => "invalid value" }}, valid_session
96
+ response.should render_template("new")
97
+ end
98
+ end
99
+ end
100
+
101
+ describe "PUT update" do
102
+ describe "with valid params" do
103
+ it "updates the requested user" do
104
+ user = User.create! valid_attributes
105
+ # Assuming there are no other users in the database, this
106
+ # specifies that the User created on the previous line
107
+ # receives the :update_attributes message with whatever params are
108
+ # submitted in the request.
109
+ User.any_instance.should_receive(:update_attributes).with({ "first_name" => "MyString" })
110
+ put :update, {:id => user.to_param, :user => { "first_name" => "MyString" }}, valid_session
111
+ end
112
+
113
+ it "assigns the requested user as @user" do
114
+ user = User.create! valid_attributes
115
+ put :update, {:id => user.to_param, :user => valid_attributes}, valid_session
116
+ assigns(:user).should eq(user)
117
+ end
118
+
119
+ it "redirects to the user" do
120
+ user = User.create! valid_attributes
121
+ put :update, {:id => user.to_param, :user => valid_attributes}, valid_session
122
+ response.should redirect_to(user)
123
+ end
124
+ end
125
+
126
+ describe "with invalid params" do
127
+ it "assigns the user as @user" do
128
+ user = User.create! valid_attributes
129
+ # Trigger the behavior that occurs when invalid params are submitted
130
+ User.any_instance.stub(:save).and_return(false)
131
+ put :update, {:id => user.to_param, :user => { "first_name" => "invalid value" }}, valid_session
132
+ assigns(:user).should eq(user)
133
+ end
134
+
135
+ it "re-renders the 'edit' template" do
136
+ user = User.create! valid_attributes
137
+ # Trigger the behavior that occurs when invalid params are submitted
138
+ User.any_instance.stub(:save).and_return(false)
139
+ put :update, {:id => user.to_param, :user => { "first_name" => "invalid value" }}, valid_session
140
+ response.should render_template("edit")
141
+ end
142
+ end
143
+ end
144
+
145
+ describe "DELETE destroy" do
146
+ it "destroys the requested user" do
147
+ user = User.create! valid_attributes
148
+ expect {
149
+ delete :destroy, {:id => user.to_param}, valid_session
150
+ }.to change(User, :count).by(-1)
151
+ end
152
+
153
+ it "redirects to the users list" do
154
+ user = User.create! valid_attributes
155
+ delete :destroy, {:id => user.to_param}, valid_session
156
+ response.should redirect_to(users_url)
157
+ end
158
+ end
159
+
160
+ end