devmail 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data/MIT-LICENSE +1 -1
  2. data/README.rdoc +1 -1
  3. data/Rakefile +27 -14
  4. data/app/assets/javascripts/devmail/application.js +16 -0
  5. data/app/assets/javascripts/devmail/messages.js +6 -0
  6. data/app/assets/stylesheets/devmail/application.css +12 -0
  7. data/app/controllers/devmail/application_controller.rb +4 -0
  8. data/app/controllers/devmail/messages_controller.rb +23 -0
  9. data/app/helpers/devmail/application_helper.rb +4 -0
  10. data/app/helpers/devmail/messages_helper.rb +4 -0
  11. data/app/mailers/devmail/sample.rb +16 -0
  12. data/app/views/devmail/messages/index.html.erb +11 -0
  13. data/app/views/devmail/messages/show.html.erb +60 -0
  14. data/app/views/devmail/sample/test.html.erb +3 -0
  15. data/app/views/devmail/sample/test.text.erb +3 -0
  16. data/app/views/layouts/devmail/application.html.erb +24 -0
  17. data/config/routes.rb +9 -4
  18. data/lib/devmail.rb +45 -1
  19. data/lib/devmail/engine.rb +5 -7
  20. data/lib/devmail/interceptor.rb +8 -0
  21. data/lib/devmail/message.rb +9 -0
  22. data/lib/devmail/storage.rb +35 -0
  23. data/lib/devmail/version.rb +3 -0
  24. data/lib/tasks/devmail_tasks.rake +4 -0
  25. data/test/devmail_test.rb +4 -0
  26. data/test/dummy/README.rdoc +261 -0
  27. data/test/dummy/Rakefile +7 -0
  28. data/test/dummy/app/assets/javascripts/application.js +15 -0
  29. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  30. data/test/dummy/app/controllers/application_controller.rb +3 -0
  31. data/test/dummy/app/helpers/application_helper.rb +2 -0
  32. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  33. data/test/dummy/config.ru +4 -0
  34. data/test/dummy/config/application.rb +65 -0
  35. data/test/dummy/config/boot.rb +10 -0
  36. data/test/dummy/config/environment.rb +5 -0
  37. data/test/dummy/config/environments/development.rb +31 -0
  38. data/test/dummy/config/environments/production.rb +64 -0
  39. data/test/dummy/config/environments/test.rb +35 -0
  40. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  41. data/test/dummy/config/initializers/inflections.rb +15 -0
  42. data/test/dummy/config/initializers/mime_types.rb +5 -0
  43. data/test/dummy/config/initializers/secret_token.rb +7 -0
  44. data/test/dummy/config/initializers/session_store.rb +8 -0
  45. data/test/dummy/config/initializers/wrap_parameters.rb +10 -0
  46. data/test/dummy/config/locales/en.yml +5 -0
  47. data/test/dummy/config/routes.rb +4 -0
  48. data/test/dummy/log/development.log +7952 -0
  49. data/test/dummy/log/test.log +0 -0
  50. data/test/dummy/public/404.html +26 -0
  51. data/test/dummy/public/422.html +26 -0
  52. data/test/dummy/public/500.html +25 -0
  53. data/test/dummy/public/favicon.ico +0 -0
  54. data/test/dummy/script/rails +6 -0
  55. data/test/dummy/tmp/cache/assets/C25/600/sprockets%2F98d406a547145182ab81985ed1917142 +0 -0
  56. data/test/dummy/tmp/cache/assets/C67/1E0/sprockets%2F66adfac10320136c0904d1358096181b +0 -0
  57. data/test/dummy/tmp/cache/assets/CBA/C00/sprockets%2F26181f46c199727821a86ddade46146e +0 -0
  58. data/test/dummy/tmp/cache/assets/D01/980/sprockets%2F2b320bc41aa3ad35eb535642893ed892 +0 -0
  59. data/test/dummy/tmp/cache/assets/D0A/E50/sprockets%2F94538f6160a5824edb3745bdd30bc14e +0 -0
  60. data/test/dummy/tmp/cache/assets/D15/8E0/sprockets%2F19734b9b01e4ea6e1e7bb89c104c1999 +0 -0
  61. data/test/dummy/tmp/cache/assets/D1C/8D0/sprockets%2F1e70db6034597fb9ee057e7b6d24538f +0 -0
  62. data/test/dummy/tmp/cache/assets/D28/F50/sprockets%2Fbe51545aa62f291e0a3e29fab2243e21 +0 -0
  63. data/test/dummy/tmp/cache/assets/D38/C50/sprockets%2F776f3f3f1305ae96e4c716d0b4be13a2 +0 -0
  64. data/test/dummy/tmp/cache/assets/D52/EC0/sprockets%2F88a3c098fbd70f65efd6155663eb5b85 +0 -0
  65. data/test/dummy/tmp/cache/assets/D57/260/sprockets%2F37fd2aeebe185999b96553ed9771be04 +0 -0
  66. data/test/dummy/tmp/cache/assets/D66/240/sprockets%2F2746a4755124b01e5d4dfefd42bef4c2 +0 -0
  67. data/test/dummy/tmp/cache/assets/D7E/950/sprockets%2Fade5fb5cdf043061497b549c99f52de8 +0 -0
  68. data/test/dummy/tmp/cache/assets/DCF/280/sprockets%2Fed0b2a8d9e191b1293ab691e43d7edff +0 -0
  69. data/test/dummy/tmp/cache/assets/DD0/7E0/sprockets%2F92f33796e0e5a2ebe42032d8f4aeedcf +0 -0
  70. data/test/dummy/tmp/cache/assets/DDE/170/sprockets%2Fb14c61f9bcfa427398f9439e3cebfdb8 +0 -0
  71. data/test/dummy/tmp/cache/assets/DF2/510/sprockets%2F5a5aaf00efdb1d335653eee92a8fa4f0 +0 -0
  72. data/test/dummy/tmp/cache/assets/E0A/580/sprockets%2F878dee3cc5c2fbf2e38162d512fefc8e +0 -0
  73. data/test/dummy/tmp/devmail.pstore +0 -0
  74. data/test/dummy/tmp/pids/server.pid +1 -0
  75. data/test/test_helper.rb +15 -0
  76. metadata +164 -95
  77. data/Gemfile +0 -3
  78. data/app/controllers/devmail/development_mails_controller.rb +0 -36
  79. data/app/models/devmail/dev_mail.rb +0 -29
  80. data/app/views/devmail/development_mails/index.html.erb +0 -25
  81. data/app/views/devmail/development_mails/show.html.erb +0 -21
  82. data/app/views/layouts/devmail/devmail.html.erb +0 -25
  83. data/config/initializers/development_mail_interceptor.rb +0 -2
  84. data/lib/devmail/development_mail_interceptor.rb +0 -30
@@ -1,29 +0,0 @@
1
- module Devmail
2
- class DevMail
3
- include Mongoid::Document
4
- include Mongoid::Timestamps
5
-
6
- field :from, :type => Array
7
- field :to, :type => Array
8
- field :cc, :type => Array
9
- field :bcc, :type => Array
10
- field :header
11
- field :sender
12
- field :subject
13
- field :reply_to, :type => Array
14
- field :text_part
15
- field :html_part
16
- field :multipart, :type => Boolean
17
- field :content_transfer_encoding
18
-
19
- field :serialized_mail
20
-
21
- def mail
22
- Mail::Message.from_yaml(self.serialized_mail)
23
- end
24
-
25
- def mail=(m)
26
- self.serialized_mail = m.to_yaml
27
- end
28
- end
29
- end
@@ -1,25 +0,0 @@
1
- <h1>Development e-mails captured:</h1>
2
-
3
- <table>
4
- <tr>
5
- <th>Sent at</th>
6
- <th>From</th>
7
- <th>To</th>
8
- <th>Subject</th>
9
- <th></th>
10
- </tr>
11
- <% for mail in @mails do -%>
12
- <tr>
13
- <td><%= mail.created_at.in_time_zone %></td>
14
- <td><%= mail.from.join(", ") %></td>
15
- <td><%= mail.to.join(", ") %></td>
16
- <td><%= mail.subject %></td>
17
- <td><%= link_to "Details", development_mail_path(mail) %>,
18
- <%= link_to "Delete", development_mail_path(mail), :confirm => 'Are you sure?', :method => :delete %>
19
- </td>
20
- </tr>
21
- <% end -%>
22
- </table>
23
-
24
- <%= link_to "Clear", clear_development_mails_path,
25
- :confirm => "Are you sure? This will remove all stored emails." %>
@@ -1,21 +0,0 @@
1
- <h1>Development email</h1>
2
-
3
- <p><b>Sent at:</b> <%= @mail.created_at.in_time_zone %></p>
4
- <p><b>From:</b> <%= @mail.from.join(", ") %></p>
5
- <p><b>To:</b> <%= @mail.to.join(", ") %></p>
6
- <p><b>Subject:</b> <%= @mail.subject %></p>
7
- <% if @mail.multipart? -%>
8
- <p><b>Text part:</b><br />
9
- <%= @mail.text_part.gsub(/\n/, "<br />").html_safe %>
10
- </p>
11
- <p>
12
- <b><%= link_to "HTML part", html_part_development_mail(@mail) %></b>
13
- </p>
14
- <% else -%>
15
- <p><b>Body:</b><br />
16
- <%= @mail.text_part.gsub(/\n/, "<br />").html_safe %>
17
- </p>
18
- <% end -%>
19
-
20
- <%= link_to "Back to list", development_mails_path %>
21
- <%= link_to 'Delete', development_mail_path(@mail), :confirm => 'Are you sure?', :method => :delete %>
@@ -1,25 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Development Emails</title>
5
- <%= stylesheet_link_tag :all %>
6
- <%= javascript_include_tag :defaults %>
7
- <%= csrf_meta_tag %>
8
- <style type="text/css">
9
- table td, table th {
10
- border: 1px solid #ccc;
11
- padding: 5px 10px;
12
- }
13
- table {
14
- border-collapse: collapse;
15
- border-spacing: 0;
16
- }
17
- </style>
18
- </head>
19
- <body>
20
-
21
- <%= yield %>
22
-
23
- </body>
24
- </html>
25
-
@@ -1,2 +0,0 @@
1
- ActionMailer::Base.register_interceptor(Devmail::DevelopmentMailInterceptor) if Rails.env.development?
2
-
@@ -1,30 +0,0 @@
1
- module Devmail
2
- class DevelopmentMailInterceptor
3
- def self.delivering_email(message)
4
- dm = DevMail.new
5
-
6
- dm.from = message.from
7
- dm.to = message.to
8
- dm.cc = message.cc
9
- dm.bcc = message.bcc
10
- dm.sender = message.sender
11
- dm.subject = message.subject
12
- dm.reply_to = message.reply_to
13
-
14
- dm.multipart = message.multipart?
15
-
16
- if message.multipart?
17
- dm.text_part = message.text_part.decoded
18
- dm.html_part = message.html_part.decoded
19
- else
20
- dm.text_part = message.decoded
21
- end
22
-
23
- dm.mail = message
24
-
25
- dm.save
26
-
27
- message
28
- end
29
- end
30
- end