Permalink
Browse files

rails5 upgrade - add rails5 configuration defaults

  • Loading branch information...
valdis committed Jun 8, 2017
1 parent 35e7d66 commit bf25f2814e6af2ccf0a4f2f4d1d7d1569d4550c4
View
@@ -112,6 +112,7 @@ end
group :development do
gem 'rb-fsevent', '~> 0.9.8', require: false
gem 'guard-rspec', '~> 4.7.3', require: false
gem 'listen', '~> 3.1.5'
gem 'annotate', '~> 2.7.1'
gem 'zeus', '~> 0.15.13', require: false
gem 'better_errors', '~> 2.1.1'
View
@@ -580,6 +580,7 @@ DEPENDENCIES
js-routes (~> 1.3.3)
jwt (~> 1.5.6)
launchy (~> 2.1)
listen (~> 3.1.5)
lograge (~> 0.5.1)
mail_view (~> 2.0.4)
memcachier (~> 0.0.2)
View
@@ -1,4 +1,4 @@
#!/usr/bin/env ruby
APP_PATH = File.expand_path('../../config/application', __FILE__)
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
View
@@ -1,6 +1,6 @@
# encoding: utf-8
require File.expand_path('../boot', __FILE__)
require_relative 'boot'
require 'rails/all'
@@ -31,6 +31,11 @@
module Kassi
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
# and thus class const
config.load_defaults 5.1
config.active_record.belongs_to_required_by_default = false
# This is a little cubersome, but this needs to be shared with the StylesheetCompiler,
# and thus class const
VENDOR_CSS_PATH = Rails.root.join("vendor", "assets", "stylesheets")
@@ -99,7 +104,7 @@ class Application < Rails::Application
config.middleware.insert_before Rack::Sendfile, ::EnforceSsl
# Handle cookies with old key
config.middleware.use Rack::MethodOverride
config.middleware.use Rack::MethodOverride
config.middleware.insert_before ActionDispatch::Cookies, ::CustomCookieRenamer
@@ -152,11 +157,6 @@ class Application < Rails::Application
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password, :password2, :account_number, :routing_number, :address_street_address,
:image, :wide_logo, :logo, :cover_photo, :small_cover_photo, :favicon,
:"date_of_birth(3i)", :"date_of_birth(2i)", :"date_of_birth(1i)"]
# ActiveRecord should be in UTC timezone.
config.time_zone = 'UTC'
View
@@ -1,6 +1,3 @@
require 'rubygems'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
require 'bundler/setup' # Set up gems listed in the Gemfile.
View
@@ -1,17 +1,18 @@
# encoding: UTF-8
# Load the rails application
require File.expand_path('../application', __FILE__)
# Load the Rails application.
require_relative 'application'
require File.expand_path('../config_loader', __FILE__)
APP_CONFIG = ConfigLoader.load_app_config
# For invalid fields, Rails adds a wrapper div.field_with_error around the input field. Which sucks,
# because I didn't ask for any wrappers to magically appear and screw my form styles. So, disable them.
# See more: https://coderwall.com/p/s-zwrg
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
ActionView::Base.field_error_proc = proc do |html_tag, instance|
html_tag.html_safe
end
# Initialize the rails application
Kassi::Application.initialize!
Rails.application.initialize!
@@ -1,6 +1,6 @@
require_relative './common.rb'
Kassi::Application.configure do
Rails.application.configure do
APP_CONFIG ||= ConfigLoader.load_app_config
# Settings specified here will take precedence over those in config/environment.rb
@@ -10,6 +10,9 @@
# since you don't have to restart the webserver when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# To autoload MailPreview, uncomment this line
# (this is a hack which is fixed properly in Rails 4)
# config.action_view.cache_template_loading = false
@@ -51,13 +54,26 @@
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Enable/disable caching. By default caching is disabled.
if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.cache_store = :memory_store, { :namespace => "sharetribe-dev"}
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
}
else
config.action_controller.perform_caching = false
config.cache_store = :null_store
end
config.action_controller.action_on_unpermitted_parameters = :raise
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_caching = false
if APP_CONFIG.mail_delivery_method == "sendmail"
ActionMailer::Base.delivery_method = :sendmail
elsif APP_CONFIG.mail_delivery_method == "smtp"
@@ -73,10 +89,20 @@
}
end
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Expands the lines which load the assets
config.assets.debug = false
config.assets.quiet = true
config.cache_store = :memory_store, { :namespace => "sharetribe-dev"}
# Raises error for missing translations
config.action_view.raise_on_missing_translations = false
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
end
@@ -1,13 +1,18 @@
require_relative './common.rb'
Kassi::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
# Code is not reloaded between requests.
# If live updates for translations are in use, caching is set to false.
config.cache_classes = (APP_CONFIG.update_translations_on_every_page_load == "true" ? false : true)
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
@@ -18,9 +23,16 @@
# For nginx:
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# If you have no front-end server that supports something like X-Sendfile,
# just comment this out and Rails will serve the files
# See everything in the log (default is :info)
config.log_level = ENV["LOG_LEVEL"] || :info
# Basic log config, for calls to Rails.logger.<level> { <message> }
config.logger = ::Logger.new(STDOUT)
# Formats log entries into: LEVEL MESSAGE
@@ -78,7 +90,6 @@
end
# Compress JavaScript and CSS
#
config.assets.js_compressor = :uglifier
# Don't fallback to assets pipeline
@@ -87,8 +98,10 @@
# Generate digests for assets URLs
config.assets.digest = true
config.action_mailer.perform_caching = false
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
config.action_mailer.raise_delivery_errors = true
# Enable threaded mode
# config.threadsafe!
@@ -97,7 +110,6 @@
# the I18n.default_locale when a translation can not be found)
# config.i18n.fallbacks = true #fallbacks defined in intitializers/i18n.rb
config.action_mailer.raise_delivery_errors = true
mail_delivery_method = (APP_CONFIG.mail_delivery_method.present? ? APP_CONFIG.mail_delivery_method.to_sym : :sendmail)
@@ -123,6 +135,9 @@
ActionMailer::Base.perform_deliveries = true # the "deliver_*" methods are available
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :log
# We don't need schema dumps in this environment
config.active_record.dump_schema_after_migration = false
end
@@ -1,16 +1,22 @@
require_relative './common.rb'
Kassi::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The staging environment is meant to be very similar to production, but to allow easier testing and debuging
# Code is not reloaded between requests
# Code is not reloaded between requests.
# If live updates for translations are in use, caching is set to false.
config.cache_classes = (APP_CONFIG.update_translations_on_every_page_load == "true" ? false : true)
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Specifies the header that your server uses for sending files
@@ -19,6 +25,10 @@
# For nginx:
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# If you have no front-end server that supports something like X-Sendfile,
# just comment this out and Rails will serve the files
@@ -88,8 +98,10 @@
# Generate digests for assets URLs
config.assets.digest = true
config.action_mailer.perform_caching = false
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
config.action_mailer.raise_delivery_errors = true
# Enable threaded mode
# config.threadsafe!
@@ -98,7 +110,6 @@
# the I18n.default_locale when a translation can not be found)
# config.i18n.fallbacks = true #fallbacks defined in intitializers/i18n.rb
config.action_mailer.raise_delivery_errors = true
mail_delivery_method = (APP_CONFIG.mail_delivery_method.present? ? APP_CONFIG.mail_delivery_method.to_sym : :sendmail)
@@ -124,6 +135,9 @@
ActionMailer::Base.perform_deliveries = true # the "deliver_*" methods are available
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :log
# We don't need schema dumps in this environment
config.active_record.dump_schema_after_migration = false
end
@@ -1,6 +1,6 @@
require_relative './common.rb'
Kassi::Application.configure do
Rails.application.configure do
# Settings specified here will take precedence over those in config/environment.rb
# The test environment is used exclusively to run your application's
@@ -9,6 +9,17 @@
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
}
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
@@ -23,6 +34,8 @@
config.action_controller.action_on_unpermitted_parameters = :raise
config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
@@ -54,7 +67,11 @@
config.cache_store = :memory_store, { :namespace => "sharetribe-test"}
config.active_support.test_order = :random
config.active_support.deprecation = :stderr
# We don't need schema dumps in this environment
config.active_record.dump_schema_after_migration = false
# Raises error for missing translations
config.action_view.raise_on_missing_translations = false
end
@@ -0,0 +1,5 @@
# Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
Rails.application.config.action_dispatch.cookies_serializer = :marshal
@@ -0,0 +1,6 @@
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password, :password2, :account_number, :routing_number, :address_street_address,
:image, :wide_logo, :logo, :cover_photo, :small_cover_photo, :favicon,
:"date_of_birth(3i)", :"date_of_birth(2i)", :"date_of_birth(1i)"]
@@ -0,0 +1,16 @@
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful'
# end
Oops, something went wrong.

0 comments on commit bf25f28

Please sign in to comment.