inbox 0.0.1 → 0.2.0

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 (52) hide show
  1. data/README.md +126 -0
  2. data/app/assets/images/inbox/results_bg.png +0 -0
  3. data/app/assets/images/inbox/tree_bg.png +0 -0
  4. data/app/assets/javascripts/inbox/application.js +1 -2
  5. data/app/assets/javascripts/inbox/emails.js +2 -0
  6. data/app/assets/stylesheets/inbox/emails.css +59 -0
  7. data/app/assets/stylesheets/inbox/panel.css.erb +229 -0
  8. data/app/assets/stylesheets/inbox/reset.css +53 -0
  9. data/app/controllers/inbox/application_controller.rb +1 -1
  10. data/app/controllers/inbox/emails_controller.rb +52 -0
  11. data/app/helpers/inbox/emails_helper.rb +4 -0
  12. data/app/mailers/inbox/email_mailer.rb +11 -0
  13. data/app/models/inbox/email.rb +51 -0
  14. data/app/views/inbox/emails/index.html.erb +0 -0
  15. data/app/views/inbox/emails/new.html.erb +9 -0
  16. data/app/views/inbox/emails/show.html.erb +48 -0
  17. data/app/views/layouts/inbox/application.html.erb +10 -9
  18. data/app/views/layouts/inbox/inbox.html.erb +25 -0
  19. data/config/routes.rb +4 -0
  20. data/lib/inbox/engine.rb +4 -0
  21. data/lib/inbox/version.rb +1 -1
  22. data/lib/inbox.rb +30 -0
  23. data/test/dummy/config/environments/development.rb +3 -1
  24. data/test/dummy/config/initializers/backtrace_silencers.rb +1 -1
  25. data/test/dummy/db/development.sqlite3 +0 -0
  26. data/test/dummy/db/production.sqlite3 +0 -0
  27. data/test/dummy/db/test.sqlite3 +0 -0
  28. data/test/dummy/log/development.log +3641 -0
  29. data/test/dummy/log/test.log +0 -0
  30. data/test/dummy/tmp/cache/assets/C4D/8B0/sprockets%2F5e1b589842222e2ea0043890c2c84539 +0 -0
  31. data/test/dummy/tmp/cache/assets/C6F/5C0/sprockets%2F259fb59d511a70d46436201b6770a04a +0 -0
  32. data/test/dummy/tmp/cache/assets/CF2/F90/sprockets%2F5378bb2470df984ccf2643991a6e476d +0 -0
  33. data/test/dummy/tmp/cache/assets/D0B/330/sprockets%2F582a2b19d6be92a0393afa63894d721a +0 -0
  34. data/test/dummy/tmp/cache/assets/D1B/CE0/sprockets%2F09c9c18794df089e62443d3debb117e5 +0 -0
  35. data/test/dummy/tmp/cache/assets/D1D/BA0/sprockets%2F29888f599d35bb11e4a8183d6dc5e23a +0 -0
  36. data/test/dummy/tmp/cache/assets/D1F/600/sprockets%2Fdd3578c9bd0719efe092c59655a25c55 +0 -0
  37. data/test/dummy/tmp/cache/assets/D21/920/sprockets%2F85fd59fe11746a33f5f917a923d84be3 +0 -0
  38. data/test/dummy/tmp/cache/assets/D4D/FB0/sprockets%2Fd5743837e8babdab4825364c4ee86f73 +0 -0
  39. data/test/dummy/tmp/cache/assets/D4F/520/sprockets%2F88ecb483df9e177ee775202ba0691ec7 +0 -0
  40. data/test/dummy/tmp/cache/assets/D6E/300/sprockets%2Fcc54b61039f74d6b8a2a7d04ad9d77f0 +0 -0
  41. data/test/dummy/tmp/cache/assets/D74/390/sprockets%2F5eda33e637dd54ff6a27bb76c482a473 +0 -0
  42. data/test/dummy/tmp/cache/assets/D76/170/sprockets%2Ffa5e461b362e11c80d5fd9e877fb63e2 +0 -0
  43. data/test/dummy/tmp/cache/assets/D7F/2D0/sprockets%2F141c2c9cb5235c8d21a00fbc8d7a2ab1 +0 -0
  44. data/test/dummy/tmp/cache/assets/D84/AA0/sprockets%2F5e841fe9d79e3ebf4333be8842b77bc5 +0 -0
  45. data/test/dummy/tmp/cache/assets/DA0/520/sprockets%2Fb8e93a54478c1f1a0e750ef2cbf74f3c +0 -0
  46. data/test/dummy/tmp/cache/assets/DC1/520/sprockets%2Feb8cea402f0bf04560adcd0cb8807b88 +0 -0
  47. data/test/dummy/tmp/mails/1345541756.4616725 +11 -0
  48. data/test/functional/inbox/email_test.rb +9 -0
  49. data/test/functional/inbox/emails_controller_test.rb +16 -0
  50. data/test/unit/helpers/inbox/emails_helper_test.rb +6 -0
  51. metadata +146 -56
  52. data/README.rdoc +0 -3
@@ -0,0 +1,25 @@
1
+ <% content_for :application do %>
2
+ <div class="panel panel_results" id="panel" style="">
3
+ <div class="result">
4
+ <ul>
5
+ <% @emails.each_with_index do |email, index| %>
6
+ <% klass = params[:id] == email.message_id ? :current : nil %>
7
+ <li class="<%=klass%>" >
8
+ <%= link_to email_path(:id => email.message_id, :mail => @mail) do %>
9
+ <h1>
10
+ <%= email.subject %>
11
+ </h1>
12
+ <p>
13
+ <%= email.from.join(", ") %>
14
+ </p>
15
+ <% end %>
16
+ </li>
17
+ <% end %>
18
+ </ul>
19
+ </div>
20
+ </div>
21
+
22
+ <%= yield %>
23
+ <% end %>
24
+
25
+ <%= render :file => 'layouts/inbox/application' %>
data/config/routes.rb CHANGED
@@ -1,2 +1,6 @@
1
1
  Inbox::Engine.routes.draw do
2
+
3
+ scope ":mail", :mail => /[^\/]+/ do
4
+ resources :emails, :only => [:index, :show, :new, :create], :id => /[^\/]+/
5
+ end
2
6
  end
data/lib/inbox/engine.rb CHANGED
@@ -1,5 +1,9 @@
1
1
  module Inbox
2
2
  class Engine < Rails::Engine
3
3
  isolate_namespace Inbox
4
+
5
+ config.after_initialize do
6
+ ActionMailer::Base.add_delivery_method :inbox, Inbox::FileDelivery, Rails.root.join("tmp/mails")
7
+ end
4
8
  end
5
9
  end
data/lib/inbox/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Inbox
2
- VERSION = "0.0.1"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/inbox.rb CHANGED
@@ -1,4 +1,34 @@
1
1
  require "inbox/engine"
2
+ require 'fileutils'
3
+ require 'pathname'
2
4
 
3
5
  module Inbox
6
+ class FileDelivery
7
+ attr_reader :location
8
+
9
+ def initialize(location)
10
+ @location = location.freeze
11
+ end
12
+
13
+ def deliver!(mail)
14
+ FileUtils.mkdir_p location
15
+ location.join(filename = Time.now.to_f.to_s).open("w") do |f|
16
+ f.write mail.encoded
17
+ end
18
+ end
19
+
20
+ def deliveries
21
+ location.each_child(false).map do |email_pathname|
22
+ Mail.read( location.join( email_pathname ) )
23
+ end
24
+ end
25
+
26
+ def clear
27
+ location.each_child(false).map do |email_pathname|
28
+ location.join(email_pathname).delete
29
+ end
30
+ end
31
+ end
32
+
33
+ ActionMailer::Base.add_delivery_method :inbox, Inbox::FileDelivery, Pathname.new("#{Dir.tmpdir}/mails")
4
34
  end
@@ -14,7 +14,9 @@ Dummy::Application.configure do
14
14
  config.action_controller.perform_caching = false
15
15
 
16
16
  # Don't care if the mailer can't send
17
- config.action_mailer.raise_delivery_errors = false
17
+ config.action_mailer.raise_delivery_errors = true
18
+ #config.action_mailer.delivery_method = :test
19
+ config.action_mailer.delivery_method = :inbox
18
20
 
19
21
  # Print deprecation notices to the Rails logger
20
22
  config.active_support.deprecation = :log
@@ -4,4 +4,4 @@
4
4
  # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
5
 
6
6
  # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
- # Rails.backtrace_cleaner.remove_silencers!
7
+ Rails.backtrace_cleaner.remove_silencers!
File without changes
File without changes
File without changes