queued_mail 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +7 -0
  2. data/lib/queued_mail/job.rb +5 -3
  3. data/lib/queued_mail/version.rb +1 -1
  4. data/spec/dummy/README.rdoc +261 -0
  5. data/spec/dummy/Rakefile +7 -0
  6. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  7. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  8. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  9. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  10. data/spec/dummy/app/mailers/jp_sample_mailer.rb +36 -0
  11. data/spec/dummy/app/mailers/sample_mailer.rb +29 -0
  12. data/spec/dummy/app/views/jp_sample_mailer/attachment_test.html.erb +5 -0
  13. data/spec/dummy/app/views/jp_sample_mailer/attachment_test.text.erb +4 -0
  14. data/spec/dummy/app/views/jp_sample_mailer/inline_attachment_test.html.erb +5 -0
  15. data/spec/dummy/app/views/jp_sample_mailer/inline_attachment_test.text.erb +5 -0
  16. data/spec/dummy/app/views/jp_sample_mailer/multipart_test.html.erb +4 -0
  17. data/spec/dummy/app/views/jp_sample_mailer/multipart_test.text.erb +4 -0
  18. data/spec/dummy/app/views/jp_sample_mailer/simple_test.text.erb +6 -0
  19. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  20. data/spec/dummy/app/views/sample_mailer/attachment_test.html.erb +2 -0
  21. data/spec/dummy/app/views/sample_mailer/attachment_test.text.erb +1 -0
  22. data/spec/dummy/app/views/sample_mailer/inline_attachment_test.html.erb +2 -0
  23. data/spec/dummy/app/views/sample_mailer/inline_attachment_test.text.erb +2 -0
  24. data/spec/dummy/app/views/sample_mailer/multipart_test.html.erb +1 -0
  25. data/spec/dummy/app/views/sample_mailer/multipart_test.text.erb +1 -0
  26. data/spec/dummy/app/views/sample_mailer/simple.text.erb +3 -0
  27. data/spec/dummy/config/application.rb +65 -0
  28. data/spec/dummy/config/aws.yml +15 -0
  29. data/spec/dummy/config/boot.rb +10 -0
  30. data/spec/dummy/config/database.yml +29 -0
  31. data/spec/dummy/config/environment.rb +5 -0
  32. data/spec/dummy/config/environments/development.rb +44 -0
  33. data/spec/dummy/config/environments/production.rb +67 -0
  34. data/spec/dummy/config/environments/test.rb +38 -0
  35. data/spec/dummy/config/initializers/aws.rb +8 -0
  36. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  37. data/spec/dummy/config/initializers/inflections.rb +15 -0
  38. data/spec/dummy/config/initializers/load_rasqueue.rb +8 -0
  39. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  40. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  41. data/spec/dummy/config/initializers/session_store.rb +8 -0
  42. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  43. data/spec/dummy/config/locales/en.yml +5 -0
  44. data/spec/dummy/config/resque.yml +3 -0
  45. data/spec/dummy/config/routes.rb +5 -0
  46. data/spec/dummy/config.ru +4 -0
  47. data/spec/dummy/db/development.sqlite3 +0 -0
  48. data/spec/dummy/db/migrate/20121031094220_create_queued_mail_messages2.queued_mail.rb +11 -0
  49. data/spec/dummy/db/schema.rb +23 -0
  50. data/spec/dummy/db/test.sqlite3 +0 -0
  51. data/spec/dummy/file/cat.jpg +0 -0
  52. data/spec/dummy/log/development.log +20 -0
  53. data/spec/dummy/log/test.log +2344 -0
  54. data/spec/dummy/public/404.html +26 -0
  55. data/spec/dummy/public/422.html +26 -0
  56. data/spec/dummy/public/500.html +25 -0
  57. data/spec/dummy/public/favicon.ico +0 -0
  58. data/spec/dummy/script/rails +6 -0
  59. data/spec/dummy/test/mailer/jp_sample_mailer_test.rb +11 -0
  60. data/spec/dummy/test/mailer/sample_mailer_test.rb +12 -0
  61. data/spec/files/001.eml +11 -0
  62. data/spec/queued_mail/delivery_method_spec.rb +50 -0
  63. data/spec/queued_mail/job_spec.rb +88 -0
  64. data/spec/queued_mail/mailer_spec.rb +38 -0
  65. data/spec/spec_helper.rb +39 -0
  66. data/spec/support/file_read.rb +4 -0
  67. metadata +164 -16
@@ -0,0 +1,44 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger
20
+ config.active_support.deprecation = :log
21
+
22
+ # Only use best-standards-support built into browsers
23
+ config.action_dispatch.best_standards_support = :builtin
24
+
25
+ # Raise exception on mass assignment protection for Active Record models
26
+ config.active_record.mass_assignment_sanitizer = :strict
27
+
28
+ # Log the query plan for queries taking more than this (works
29
+ # with SQLite, MySQL, and PostgreSQL)
30
+ config.active_record.auto_explain_threshold_in_seconds = 0.5
31
+
32
+ # Do not compress assets
33
+ config.assets.compress = false
34
+
35
+ # Expands the lines which load the assets
36
+ config.assets.debug = true
37
+
38
+ #config.action_mailer.delivery_method = :sendmail
39
+ config.mail_queue_outbound_delivery_method = :smtp
40
+ if FileTest.file?("#{Rails.root.to_s}/config/smtp_settings.yml")
41
+ smtp_settings = YAML::load(File.open("#{Rails.root.to_s}/config/smtp_settings.yml"))
42
+ ActionMailer::Base.smtp_settings = smtp_settings[Rails.env] unless smtp_settings[Rails.env].nil?
43
+ end
44
+ end
@@ -0,0 +1,67 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Full error reports are disabled and caching is turned on
8
+ config.consider_all_requests_local = false
9
+ config.action_controller.perform_caching = true
10
+
11
+ # Disable Rails's static asset server (Apache or nginx will already do this)
12
+ config.serve_static_assets = false
13
+
14
+ # Compress JavaScripts and CSS
15
+ config.assets.compress = true
16
+
17
+ # Don't fallback to assets pipeline if a precompiled asset is missed
18
+ config.assets.compile = false
19
+
20
+ # Generate digests for assets URLs
21
+ config.assets.digest = true
22
+
23
+ # Defaults to nil and saved in location specified by config.assets.prefix
24
+ # config.assets.manifest = YOUR_PATH
25
+
26
+ # Specifies the header that your server uses for sending files
27
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29
+
30
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
+ # config.force_ssl = true
32
+
33
+ # See everything in the log (default is :info)
34
+ # config.log_level = :debug
35
+
36
+ # Prepend all log lines with the following tags
37
+ # config.log_tags = [ :subdomain, :uuid ]
38
+
39
+ # Use a different logger for distributed setups
40
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41
+
42
+ # Use a different cache store in production
43
+ # config.cache_store = :mem_cache_store
44
+
45
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
46
+ # config.action_controller.asset_host = "http://assets.example.com"
47
+
48
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
49
+ # config.assets.precompile += %w( search.js )
50
+
51
+ # Disable delivery errors, bad email addresses will be ignored
52
+ # config.action_mailer.raise_delivery_errors = false
53
+
54
+ # Enable threaded mode
55
+ # config.threadsafe!
56
+
57
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58
+ # the I18n.default_locale when a translation can not be found)
59
+ config.i18n.fallbacks = true
60
+
61
+ # Send deprecation notices to registered listeners
62
+ config.active_support.deprecation = :notify
63
+
64
+ # Log the query plan for queries taking more than this (works
65
+ # with SQLite, MySQL, and PostgreSQL)
66
+ # config.active_record.auto_explain_threshold_in_seconds = 0.5
67
+ end
@@ -0,0 +1,38 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Configure static asset server for tests with Cache-Control for performance
11
+ config.serve_static_assets = true
12
+ config.static_cache_control = "public, max-age=3600"
13
+
14
+ # Log error messages when you accidentally call methods on nil
15
+ config.whiny_nils = true
16
+
17
+ # Show full error reports and disable caching
18
+ config.consider_all_requests_local = true
19
+ config.action_controller.perform_caching = false
20
+
21
+ # Raise exceptions instead of rendering exception templates
22
+ config.action_dispatch.show_exceptions = false
23
+
24
+ # Disable request forgery protection in test environment
25
+ config.action_controller.allow_forgery_protection = false
26
+
27
+ # Tell Action Mailer not to deliver emails to the real world.
28
+ # The :test delivery method accumulates sent emails in the
29
+ # ActionMailer::Base.deliveries array.
30
+
31
+ # Raise exception on mass assignment protection for Active Record models
32
+ config.active_record.mass_assignment_sanitizer = :strict
33
+
34
+ # Print deprecation notices to the stderr
35
+ config.active_support.deprecation = :stderr
36
+
37
+ config.mail_queue_outbound_delivery_method = :test
38
+ end
@@ -0,0 +1,8 @@
1
+ # load the libraries
2
+ require 'aws'
3
+ # log requests using the default rails logger
4
+ #AWS.config(logger: ActiveSupport::TaggedLogging.new(SyslogLogger.new))
5
+ AWS.config(logger: Rails.logger)
6
+ # load credentials from a file
7
+ config_path = File.expand_path(File.dirname(__FILE__)+"/../aws.yml")
8
+ AWS.config(YAML.load(File.read(config_path))[Rails.env])
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
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!
@@ -0,0 +1,15 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
11
+ #
12
+ # These inflection rules are supported but not enabled by default:
13
+ # ActiveSupport::Inflector.inflections do |inflect|
14
+ # inflect.acronym 'RESTful'
15
+ # end
@@ -0,0 +1,8 @@
1
+ require 'resque'
2
+
3
+ rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..'
4
+ rails_env = ENV['RAILS_ENV'] || 'development'
5
+
6
+ resque_config = YAML.load_file(rails_root + '/config/resque.yml')
7
+ Resque.redis = resque_config[rails_env]
8
+
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Dummy::Application.config.secret_token = '6ab3dc53e584d061bffd0285e9a2286377dbedf02ba90c265f281359f5e2a73e44a25595411222a31b5597236249f1de2301443d1acf9fda866fae736f185592'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,3 @@
1
+ development: localhost:6379
2
+ test: localhost:6379
3
+ production: localhost:6379
@@ -0,0 +1,5 @@
1
+ require 'resque/server'
2
+
3
+ Rails.application.routes.draw do
4
+ mount Resque::Server.new, :at => "/"
5
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
Binary file
@@ -0,0 +1,11 @@
1
+ # This migration comes from queued_mail (originally 20121031151500)
2
+ class CreateQueuedMailMessages2 < ActiveRecord::Migration
3
+ def change
4
+ create_table :queued_mail_messages do |t|
5
+ t.binary :source, :limit => 30.megabyte
6
+ t.string :bcc_addresses
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,23 @@
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 => 20121031094220) do
15
+
16
+ create_table "queued_mail_messages", :force => true do |t|
17
+ t.binary "source", :limit => 2147483647
18
+ t.string "bcc_addresses"
19
+ t.datetime "created_at", :null => false
20
+ t.datetime "updated_at", :null => false
21
+ end
22
+
23
+ end
Binary file
Binary file
@@ -0,0 +1,20 @@
1
+ Connecting to database specified by database.yml
2
+ Connecting to database specified by database.yml
3
+ Connecting to database specified by database.yml
4
+  (42.5ms) CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB
5
+  (21.1ms) CREATE UNIQUE INDEX `unique_schema_migrations` ON `schema_migrations` (`version`)
6
+  (0.2ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` 
7
+ Migrating to CreateQueuedMailMessages2 (20121031094220)
8
+  (4.1ms) CREATE TABLE `queued_mail_messages` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `source` blob(31457280), `bcc_addresses` varchar(255), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
9
+  (1.8ms) INSERT INTO `schema_migrations` (`version`) VALUES ('20121031094220')
10
+  (0.2ms) SELECT `schema_migrations`.`version` FROM `schema_migrations`
11
+ Connecting to database specified by database.yml
12
+  (0.1ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` 
13
+  (0.3ms) DROP DATABASE IF EXISTS `queued_mail_dummy_test`
14
+  (0.2ms) CREATE DATABASE `queued_mail_dummy_test` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`
15
+  (43.8ms) CREATE TABLE `queued_mail_messages` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `source` blob(2147483647), `bcc_addresses` varchar(255), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
16
+  (6.2ms) CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB
17
+  (21.9ms) CREATE UNIQUE INDEX `unique_schema_migrations` ON `schema_migrations` (`version`)
18
+  (0.5ms) SELECT version FROM `schema_migrations`
19
+  (2.9ms) INSERT INTO `schema_migrations` (version) VALUES ('20121031094220')
20
+ Connecting to database specified by database.yml