chr 0.5.1 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/.coffeescript-style.json +98 -0
  3. data/.hound.yml +16 -0
  4. data/.ruby-style.yml +239 -0
  5. data/.scss-style.yml +145 -0
  6. data/.travis.yml +2 -2
  7. data/README.md +10 -3
  8. data/app/assets/javascripts/chr/chr.coffee +4 -25
  9. data/app/assets/javascripts/chr/chr_router.coffee +2 -14
  10. data/app/assets/javascripts/chr/item.coffee +2 -19
  11. data/app/assets/javascripts/chr/list.coffee +6 -18
  12. data/app/assets/javascripts/chr/list_config.coffee +3 -10
  13. data/app/assets/javascripts/chr/list_pagination.coffee +1 -9
  14. data/app/assets/javascripts/chr/list_reorder.coffee +1 -8
  15. data/app/assets/javascripts/chr/list_search.coffee +2 -10
  16. data/app/assets/javascripts/chr/list_tabs.coffee +42 -0
  17. data/app/assets/javascripts/chr/module-categories.coffee +0 -2
  18. data/app/assets/javascripts/chr/module.coffee +1 -19
  19. data/app/assets/javascripts/chr/utils.coffee +0 -6
  20. data/app/assets/javascripts/chr/view.coffee +37 -36
  21. data/app/assets/javascripts/chr/view_tabs.coffee +19 -8
  22. data/app/assets/javascripts/stores/rest-array.coffee +23 -36
  23. data/app/assets/stylesheets/chr/layout.scss +17 -13
  24. data/app/assets/stylesheets/chr/themes/basic.scss +13 -13
  25. data/lib/chr/version.rb +1 -1
  26. data/templates/character_admin.coffee.erb +1 -1
  27. data/test/integration/article_fullsize_test.rb +5 -5
  28. data/test/integration/article_test.rb +2 -2
  29. data/test/integration/magazine_article_test.rb +5 -5
  30. data/test/integration/restricted_article_test.rb +3 -3
  31. data/test/integration/sport_article_test.rb +2 -2
  32. data/test/rails_app/.gitignore +15 -0
  33. data/test/rails_app/.ruby-version +1 -0
  34. data/test/rails_app/.sample.env +6 -0
  35. data/test/rails_app/Procfile +1 -0
  36. data/test/rails_app/README.md +45 -0
  37. data/test/rails_app/Rakefile +1 -1
  38. data/test/rails_app/app/assets/images/.keep +0 -0
  39. data/test/rails_app/app/assets/javascripts/admin.coffee +82 -102
  40. data/test/rails_app/app/assets/javascripts/application.coffee +2 -0
  41. data/test/rails_app/app/assets/stylesheets/admin.scss +4 -1
  42. data/test/rails_app/app/assets/stylesheets/application.scss +1 -0
  43. data/test/rails_app/app/controllers/admin/base_controller.rb +5 -0
  44. data/test/rails_app/app/controllers/admin/devise_overrides/passwords_controller.rb +9 -0
  45. data/test/rails_app/app/controllers/admin/devise_overrides/sessions_controller.rb +11 -0
  46. data/test/rails_app/app/controllers/concerns/.keep +0 -0
  47. data/test/rails_app/app/helpers/body_class_helper.rb +15 -0
  48. data/test/rails_app/app/mailers/.keep +0 -0
  49. data/test/rails_app/app/models/.keep +0 -0
  50. data/test/rails_app/app/models/article.rb +0 -4
  51. data/test/rails_app/app/models/concerns/.keep +0 -0
  52. data/test/rails_app/app/uploaders/article_image_uploader.rb +0 -4
  53. data/test/rails_app/app/views/admin/devise_overrides/passwords/edit.html.erb +31 -0
  54. data/test/rails_app/app/views/admin/devise_overrides/passwords/new.html.erb +19 -0
  55. data/test/rails_app/app/views/admin/devise_overrides/sessions/new.html.erb +29 -0
  56. data/test/rails_app/app/views/admin/index.html.erb +1 -3
  57. data/test/rails_app/app/views/application/_analytics.html.erb +9 -0
  58. data/test/rails_app/app/views/application/_flashes.html.erb +7 -0
  59. data/test/rails_app/app/views/application/_javascript.html.erb +12 -0
  60. data/test/rails_app/app/views/layouts/admin.html.erb +13 -11
  61. data/test/rails_app/app/views/layouts/application.html.erb +22 -7
  62. data/test/rails_app/bin/rails +3 -2
  63. data/test/rails_app/bin/rake +3 -2
  64. data/test/rails_app/bin/setup +28 -22
  65. data/test/rails_app/bin/spring +6 -6
  66. data/test/rails_app/config/application.rb +12 -1
  67. data/test/rails_app/config/boot.rb +1 -2
  68. data/test/rails_app/config/environments/development.rb +2 -0
  69. data/test/rails_app/config/environments/production.rb +16 -1
  70. data/test/rails_app/config/environments/staging.rb +9 -0
  71. data/test/rails_app/config/environments/test.rb +1 -3
  72. data/test/rails_app/config/initializers/assets.rb +2 -3
  73. data/test/rails_app/config/initializers/carrierwave.rb +23 -4
  74. data/test/rails_app/config/initializers/devise.rb +265 -0
  75. data/test/rails_app/config/initializers/errors.rb +34 -0
  76. data/test/rails_app/config/initializers/json_encoding.rb +1 -0
  77. data/test/rails_app/config/locales/devise.en.yml +62 -0
  78. data/test/rails_app/config/mongoid.yml +131 -8
  79. data/test/rails_app/config/newrelic.yml +34 -0
  80. data/test/rails_app/config/puma.rb +18 -0
  81. data/test/rails_app/config/routes.rb +86 -0
  82. data/test/rails_app/config/secrets.yml +8 -16
  83. data/test/rails_app/config/smtp.rb +9 -0
  84. data/test/rails_app/lib/assets/.keep +0 -0
  85. data/test/rails_app/lib/tasks/.keep +0 -0
  86. data/test/rails_app/lib/tasks/bundler_audit.rake +12 -0
  87. data/test/rails_app/lib/tasks/dev.rake +12 -0
  88. data/test/rails_app/public/404.html +4 -2
  89. data/test/rails_app/public/422.html +4 -2
  90. data/test/rails_app/public/500.html +4 -2
  91. data/test/rails_app/vendor/assets/javascripts/.keep +0 -0
  92. data/test/rails_app/vendor/assets/stylesheets/.keep +0 -0
  93. data/test/support/character_front_end.rb +10 -9
  94. data/test/support/chr/list_pagination.rb +8 -8
  95. data/test/support/chr/list_reorder.rb +4 -1
  96. data/test/support/chr/view.rb +4 -3
  97. data/test/support/stores/rest-array.rb +3 -3
  98. data/test/test_helper.rb +13 -7
  99. metadata +77 -6
  100. data/test/rails_app/app/assets/javascripts/application.js +0 -1
  101. data/test/rails_app/app/assets/stylesheets/application.css +0 -1
@@ -0,0 +1,2 @@
1
+ #= require jquery
2
+ #= require jquery_ujs
@@ -1 +1,4 @@
1
- @import "chr";
1
+ @import "chr";
2
+ // @import "loft";
3
+ // @import "ants";
4
+ @import "font-awesome";
@@ -0,0 +1 @@
1
+ @import "normalize-rails";
@@ -1,7 +1,12 @@
1
1
  class Admin::BaseController < ActionController::Base
2
2
  protect_from_forgery
3
+ # before_action :authenticate_admin_user!
3
4
 
4
5
  def index
5
6
  render '/admin/index', layout: 'admin'
6
7
  end
8
+
9
+ def bootstrap_data
10
+ render json: {}
11
+ end
7
12
  end
@@ -0,0 +1,9 @@
1
+ class Admin::DeviseOverrides::PasswordsController < Devise::PasswordsController
2
+ layout 'admin'
3
+
4
+ protected
5
+
6
+ def after_resetting_password_path_for(resource)
7
+ admin_path
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ class Admin::DeviseOverrides::SessionsController < Devise::SessionsController
2
+ layout 'admin'
3
+
4
+ def after_sign_in_path_for(resource)
5
+ admin_path
6
+ end
7
+
8
+ def after_sign_out_path_for(resource)
9
+ new_admin_user_session_path
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ # Body class helper striped our from:
2
+ # https://github.com/thoughtbot/flutie/blob/master/lib/flutie/body_class_helper.rb
3
+ module BodyClassHelper
4
+ def body_class(options = {})
5
+ extra_body_classes_symbol = options[:extra_body_classes_symbol] || :extra_body_classes
6
+ qualified_controller_name = controller.controller_path.gsub('/','-')
7
+ basic_body_class = "#{qualified_controller_name} #{qualified_controller_name}-#{controller.action_name}"
8
+
9
+ if content_for?(extra_body_classes_symbol)
10
+ [basic_body_class, content_for(extra_body_classes_symbol)].join(' ')
11
+ else
12
+ basic_body_class
13
+ end
14
+ end
15
+ end
File without changes
File without changes
@@ -40,7 +40,3 @@ class Article
40
40
  end
41
41
 
42
42
  end
43
-
44
-
45
-
46
-
@@ -10,7 +10,3 @@ class ArticleImageUploader < CarrierWave::Uploader::Base
10
10
  end
11
11
 
12
12
  end
13
-
14
-
15
-
16
-
@@ -0,0 +1,31 @@
1
+ <% set_meta_tags title: "Change Password" %>
2
+
3
+ <div class='signin-modal'>
4
+ <h2>Change password</h2>
5
+ <p class='notice'><%= notice %></p>
6
+ <p class='alert'><%= alert %></p>
7
+
8
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
9
+ <%= f.hidden_field :reset_password_token %>
10
+
11
+ <label for='admin_user_password' class='form-input input-required input-string'>
12
+ <div class='label'>
13
+ New password
14
+ <% if @minimum_password_length %>
15
+ <em>(<%= @minimum_password_length %> characters minimum)</em>
16
+ <% end %>
17
+ </div>
18
+ <%= f.password_field :password, autocomplete: "off", tabindex: 1 %>
19
+ </label>
20
+
21
+ <label for='admin_user_password_confirmation' class='form-input input-required input-string'>
22
+ <div class='label'>Confirm new password</div>
23
+ <%= f.password_field :password_confirmation, autocomplete: "off", tabindex: 2 %>
24
+ </label>
25
+
26
+ <%= devise_error_messages! %>
27
+
28
+ <%= f.submit "Change password", tabindex: 3 %>
29
+ <%= link_to "Sign In", new_session_path(resource_name) %>
30
+ <% end %>
31
+ </div>
@@ -0,0 +1,19 @@
1
+ <% set_meta_tags title: "Reset Password" %>
2
+
3
+ <div class='signin-modal'>
4
+ <h2>Forgot your password?</h2>
5
+ <p class='notice'><%= notice %></p>
6
+ <p class='alert'><%= alert %></p>
7
+
8
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
9
+ <label for='admin_user_email' class='form-input input-required input-string'>
10
+ <div class='label'>Email</div>
11
+ <%= f.email_field :email, autofocus: true, tabindex: 1 %>
12
+ </label>
13
+
14
+ <%= devise_error_messages! %>
15
+
16
+ <%= f.submit "Reset password", tabindex: 2 %>
17
+ <%= link_to "Sign In", new_session_path(resource_name) %>
18
+ <% end %>
19
+ </div>
@@ -0,0 +1,29 @@
1
+ <% set_meta_tags title: "Sing in" %>
2
+
3
+ <div class='signin-modal'>
4
+ <h2>Sign in</h2>
5
+ <p class='notice'><%= notice %></p>
6
+ <p class='alert'><%= alert %></p>
7
+
8
+ <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
9
+ <label for='admin_user_email' class='form-input input-required input-string'>
10
+ <div class='label'>Email</div>
11
+ <%= f.email_field :email, autofocus: true, tabindex: 1 %>
12
+ </label>
13
+
14
+ <label for='admin_user_password' class='form-input input-required input-string'>
15
+ <div class='label'>Password <%= link_to 'Forgot?', new_password_path(resource_name) %></div>
16
+ <%= f.password_field :password, autocomplete: "off", tabindex: 2 %>
17
+ </label>
18
+
19
+ <label for='admin_user_remember_me' class='form-input input-switch'>
20
+ <div class='switch'>
21
+ <%= f.check_box :remember_me, tabindex: 3 %>
22
+ <div class='checkbox'></div>
23
+ </div>
24
+ <span class='label'>Remember me</span>
25
+ </label>
26
+
27
+ <%= f.submit "Sign in", tabindex: 4 %>
28
+ <% end %>
29
+ </div>
@@ -1,4 +1,2 @@
1
- <body>
2
- </body>
1
+ <%= javascript_include_tag :admin %>
3
2
 
4
- <%= javascript_include_tag :admin %>
@@ -0,0 +1,9 @@
1
+ <% if ENV["SEGMENT_IO_KEY"] %>
2
+ <script type="text/javascript">
3
+ window.analytics=window.analytics||[],window.analytics.methods=["identify","group","track","page","pageview","alias","ready","on","once","off","trackLink","trackForm","trackClick","trackSubmit"],window.analytics.factory=function(t){return function(){var a=Array.prototype.slice.call(arguments);return a.unshift(t),window.analytics.push(a),window.analytics}};for(var i=0;i<window.analytics.methods.length;i++){var key=window.analytics.methods[i];window.analytics[key]=window.analytics.factory(key)}window.analytics.load=function(t){if(!document.getElementById("analytics-js")){var a=document.createElement("script");a.type="text/javascript",a.id="analytics-js",a.async=!0,a.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.io/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n)}},window.analytics.SNIPPET_VERSION="2.0.9",
4
+ window.analytics.load("<%= ENV["SEGMENT_IO_KEY"] %>");
5
+ window.analytics.page();
6
+ </script>
7
+ <% end %>
8
+
9
+ <% # @todo: add google analytics %>
@@ -0,0 +1,7 @@
1
+ <% if flash.any? %>
2
+ <div id="flash">
3
+ <% flash.each do |key, value| -%>
4
+ <div class="flash-<%= key %>"><%= value %></div>
5
+ <% end -%>
6
+ </div>
7
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <%= javascript_include_tag :application %>
2
+
3
+ <%= yield :javascript %>
4
+
5
+ <%= render "analytics" %>
6
+
7
+ <% if Rails.env.test? %>
8
+ <%= javascript_tag do %>
9
+ $.fx.off = true;
10
+ $.ajaxSetup({ async: false });
11
+ <% end %>
12
+ <% end %>
@@ -1,17 +1,19 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
7
- <meta name="apple-mobile-web-app-capable" content="yes">
8
- <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
9
6
 
10
- <title>Admin</title>
7
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
8
+ <meta name="apple-mobile-web-app-capable" content="yes">
9
+ <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
11
10
 
12
- <%= csrf_meta_tags %>
13
- <%= stylesheet_link_tag :admin, media: "all" %>
14
- </head>
11
+ <%= csrf_meta_tags %>
12
+ <%= stylesheet_link_tag :admin, media: "all" %>
13
+ </head>
15
14
 
15
+ <body class="<%= body_class %>">
16
16
  <%= yield %>
17
+ </body>
18
+
17
19
  </html>
@@ -1,14 +1,29 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <title>RailsApp</title>
5
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
- <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
4
+ <meta charset="utf-8" />
5
+ <meta name="ROBOTS" content="NOODP" />
6
+ <meta name="viewport" content="initial-scale=1" />
10
7
 
11
- <%= yield %>
8
+ <%#
9
+ Configure default meta tags values, for more details see:
10
+ https://github.com/kpumuk/meta-tags
11
+ %>
12
+ <%= display_meta_tags site: 'rails_app',
13
+ description: '',
14
+ og: { site_name: 'rails_app',
15
+ url: '',
16
+ title: '',
17
+ description: '',
18
+ type: 'website',
19
+ image: '' } %>
12
20
 
21
+ <%= stylesheet_link_tag :application, media: "all" %>
22
+ <%= csrf_meta_tags %>
23
+ </head>
24
+ <body class="<%= body_class %>">
25
+ <%= render "flashes" -%>
26
+ <%= yield %>
27
+ <%= render "javascript" %>
13
28
  </body>
14
29
  </html>
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  begin
3
- load File.expand_path("../spring", __FILE__)
4
- rescue LoadError
3
+ load File.expand_path('../spring', __FILE__)
4
+ rescue LoadError => e
5
+ raise unless e.message.include?('spring')
5
6
  end
6
7
  APP_PATH = File.expand_path('../../config/application', __FILE__)
7
8
  require_relative '../config/boot'
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  begin
3
- load File.expand_path("../spring", __FILE__)
4
- rescue LoadError
3
+ load File.expand_path('../spring', __FILE__)
4
+ rescue LoadError => e
5
+ raise unless e.message.include?('spring')
5
6
  end
6
7
  require_relative '../config/boot'
7
8
  require 'rake'
@@ -1,29 +1,35 @@
1
- #!/usr/bin/env ruby
2
- require 'pathname'
1
+ #!/usr/bin/env sh
3
2
 
4
- # path to your application root.
5
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
3
+ # Set up Rails app. Run this script immediately after cloning the codebase.
4
+ # https://github.com/thoughtbot/guides/tree/master/protocol
6
5
 
7
- Dir.chdir APP_ROOT do
8
- # This script is a starting point to setup your application.
9
- # Add necessary setup steps to this file:
6
+ # Exit if any subcommand fails
7
+ set -e
10
8
 
11
- puts "== Installing dependencies =="
12
- system "gem install bundler --conservative"
13
- system "bundle check || bundle install"
9
+ # Set up Ruby dependencies via Bundler
10
+ gem install bundler --conservative
11
+ bundle check || bundle install
14
12
 
15
- # puts "\n== Copying sample files =="
16
- # unless File.exist?("config/database.yml")
17
- # system "cp config/database.yml.sample config/database.yml"
18
- # end
13
+ # Set up configurable environment variables
14
+ if [ ! -f .env ]; then
15
+ cp .sample.env .env
16
+ fi
19
17
 
20
- puts "\n== Preparing database =="
21
- system "bin/rake db:setup"
18
+ # Set up database and add any development seed data
19
+ bin/rake dev:prime
22
20
 
23
- puts "\n== Removing old logs and tempfiles =="
24
- system "rm -f log/*"
25
- system "rm -rf tmp/cache"
21
+ # Add binstubs to PATH via export PATH=".git/safe/../../bin:$PATH" in ~/.zshenv
22
+ mkdir -p .git/safe
26
23
 
27
- puts "\n== Restarting application server =="
28
- system "touch tmp/restart.txt"
29
- end
24
+ # Pick a port for Foreman
25
+ if ! grep --quiet --no-messages --fixed-strings 'port' .foreman; then
26
+ printf 'port: 3000\n' >> .foreman
27
+ fi
28
+
29
+ if ! command -v foreman > /dev/null; then
30
+ gem install foreman
31
+ fi
32
+
33
+ # Only if this isn't CI
34
+ # if [ -z "$CI" ]; then
35
+ # fi
@@ -4,12 +4,12 @@
4
4
  # It gets overwritten when you run the `spring binstub` command.
5
5
 
6
6
  unless defined?(Spring)
7
- require "rubygems"
8
- require "bundler"
7
+ require 'rubygems'
8
+ require 'bundler'
9
9
 
10
- if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
11
- Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq }
12
- gem "spring", match[1]
13
- require "spring/binstub"
10
+ if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m))
11
+ Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq }
12
+ gem 'spring', match[1]
13
+ require 'spring/binstub'
14
14
  end
15
15
  end
@@ -9,7 +9,8 @@ require "action_controller/railtie"
9
9
  require "action_mailer/railtie"
10
10
  require "action_view/railtie"
11
11
  require "sprockets/railtie"
12
- require "rails/test_unit/railtie"
12
+ # require "devise"
13
+ # require "rails/test_unit/railtie"
13
14
 
14
15
  # Require the gems listed in Gemfile, including any gems
15
16
  # you've limited to :test, :development, or :production.
@@ -19,8 +20,17 @@ FactoryGirl.definition_file_paths << Pathname.new("../factories")
19
20
  FactoryGirl.definition_file_paths.uniq!
20
21
  FactoryGirl.find_definitions
21
22
 
23
+
22
24
  module RailsApp
23
25
  class Application < Rails::Application
26
+
27
+ config.generators do |generate|
28
+ generate.helper false
29
+ generate.javascript_engine false
30
+ generate.stylesheets false
31
+ end
32
+
33
+ config.action_controller.action_on_unpermitted_parameters = :raise
24
34
  # Settings in config/environments/* take precedence over those specified here.
25
35
  # Application configuration should go into files in config/initializers
26
36
  # -- all .rb files in that directory are automatically loaded.
@@ -34,3 +44,4 @@ module RailsApp
34
44
  # config.i18n.default_locale = :de
35
45
  end
36
46
  end
47
+ Mongo::Logger.logger.level = Logger::INFO
@@ -1,3 +1,2 @@
1
- # Set up gems listed in the Gemfile.
2
1
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
2
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -35,4 +35,6 @@ Rails.application.configure do
35
35
 
36
36
  # Raises error for missing translations
37
37
  # config.action_view.raise_on_missing_translations = true
38
+
39
+ config.action_mailer.default_url_options = { host: "localhost:3000" }
38
40
  end
@@ -1,3 +1,4 @@
1
+ require Rails.root.join("config/smtp")
1
2
  Rails.application.configure do
2
3
  # Settings specified here will take precedence over those in config/application.rb.
3
4
 
@@ -23,6 +24,12 @@ Rails.application.configure do
23
24
  # Disable serving static files from the `/public` folder by default since
24
25
  # Apache or NGINX already handles this.
25
26
  config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
27
+ config.static_cache_control = "public, max-age=#{1.year.to_i}"
28
+ # Enable deflate / gzip compression of controller-generated responses
29
+ config.middleware.use Rack::Deflater
30
+
31
+ # Ensure requests are only served from one, canonical host name
32
+ config.middleware.use Rack::CanonicalHost, ENV.fetch("HOST")
26
33
 
27
34
  # Compress JavaScripts and CSS.
28
35
  config.assets.js_compressor = :uglifier
@@ -58,11 +65,14 @@ Rails.application.configure do
58
65
  # config.cache_store = :mem_cache_store
59
66
 
60
67
  # Enable serving of images, stylesheets, and JavaScripts from an asset server.
61
- # config.action_controller.asset_host = 'http://assets.example.com'
68
+ config.action_controller.asset_host = ENV.fetch("ASSET_HOST")
62
69
 
63
70
  # Ignore bad email addresses and do not raise email delivery errors.
64
71
  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
65
72
  # config.action_mailer.raise_delivery_errors = false
73
+ config.action_mailer.delivery_method = :smtp
74
+ config.action_mailer.smtp_settings = SMTP_SETTINGS
75
+
66
76
 
67
77
  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
68
78
  # the I18n.default_locale when a translation cannot be found).
@@ -73,4 +83,9 @@ Rails.application.configure do
73
83
 
74
84
  # Use default logging formatter so that PID and timestamp are not suppressed.
75
85
  config.log_formatter = ::Logger::Formatter.new
86
+
87
+ config.action_mailer.default_url_options = { host: ENV.fetch("HOST") }
88
+
89
+ config.action_mailer.asset_host = "http://#{ ENV.fetch("ASSET_HOST") }"
76
90
  end
91
+ Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i