From 5407ef5b377a205f6012b2d6725b810eff93d9e6 Mon Sep 17 00:00:00 2001 From: Azul Date: Wed, 23 Mar 2016 21:31:33 +0100 Subject: upgrade: drop active_resource in config/application --- config/application.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'config') diff --git a/config/application.rb b/config/application.rb index b13c7d9..4771f89 100644 --- a/config/application.rb +++ b/config/application.rb @@ -4,7 +4,6 @@ require File.expand_path('../boot', __FILE__) # require "active_record/railtie" require "action_controller/railtie" require "action_mailer/railtie" -require "active_resource/railtie" require "sprockets/railtie" require "rails/test_unit/railtie" -- cgit v1.2.3 From 065859b90cc5ef403b8f47bd5394b343e556cc4d Mon Sep 17 00:00:00 2001 From: Azul Date: Wed, 23 Mar 2016 21:48:52 +0100 Subject: upgrade: remove references to RestClient CouchRest > 1.2 does not use RestClient anymore. So we should not try to catch its errors. --- config/initializers/error_constants.rb | 5 +++++ config/initializers/validations.rb | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) delete mode 100644 config/initializers/validations.rb (limited to 'config') diff --git a/config/initializers/error_constants.rb b/config/initializers/error_constants.rb index fdd3624..bf2dad4 100644 --- a/config/initializers/error_constants.rb +++ b/config/initializers/error_constants.rb @@ -1,3 +1,8 @@ require 'ruby-srp' WRONG_PASSWORD = SRP::WrongPassword + +# In case we use a different ORM at some point +VALIDATION_FAILED = CouchRest::Model::Errors::Validations +RECORD_NOT_FOUND = CouchRest::Model::DocumentNotFound +RESOURCE_NOT_FOUDN = CouchRest::NotFound diff --git a/config/initializers/validations.rb b/config/initializers/validations.rb deleted file mode 100644 index e8acfbe..0000000 --- a/config/initializers/validations.rb +++ /dev/null @@ -1,4 +0,0 @@ -# In case we use a different ORM at some point -VALIDATION_FAILED = CouchRest::Model::Errors::Validations -RECORD_NOT_FOUND = CouchRest::Model::DocumentNotFound -RESOURCE_NOT_FOUND = RestClient::ResourceNotFound -- cgit v1.2.3 From 9a8f1da14f6a0ab83206c57059fbc8cf5bc77b60 Mon Sep 17 00:00:00 2001 From: Azul Date: Wed, 23 Mar 2016 22:19:27 +0100 Subject: upgrade: no more underspecified match routes --- config/routes.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'config') diff --git a/config/routes.rb b/config/routes.rb index e370aa4..be3b3be 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,8 +10,8 @@ LeapWeb::Application.routes.draw do # HTTP Error Handling # instead of the default error pages use the errors controller and views # - match '/404' => 'errors#not_found' - match '/500' => 'errors#server_error' + match '/404' => 'errors#not_found', via: [:get, :post] + match '/500' => 'errors#server_error', via: [:get, :post] scope "(:locale)", :locale => CommonLanguages.match_available, :controller => 'pages', :action => 'show' do get 'privacy-policy', :as => 'privacy_policy' -- cgit v1.2.3 From cb58e83c3525917da381bd43773fc2c3c40811ea Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 24 Mar 2016 09:41:53 +0100 Subject: upgrade: environments/test.rb Changed according to http://railsdiff.org/3.2.22.2/4.2.6 Should also get rid of some warnings. --- config/environments/test.rb | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'config') diff --git a/config/environments/test.rb b/config/environments/test.rb index 1a38df7..8ed23ed 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,5 +1,5 @@ -LeapWeb::Application.configure do - # Settings specified here will take precedence over those in config/application.rb +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that @@ -7,29 +7,36 @@ LeapWeb::Application.configure do # and recreated between test runs. Don't rely on the data there! config.cache_classes = true - # Configure static asset server for tests with Cache-Control for performance - config.serve_static_assets = true - config.static_cache_control = "public, max-age=3600" + # 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 - # Log error messages when you accidentally call methods on nil - config.whiny_nils = true + # Configure static asset server for tests with Cache-Control for performance + config.serve_static_files = true + config.static_cache_control = 'public, max-age=3600' - # Show full error reports and disable caching + # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false - # Raise exceptions instead of rendering exception templates + # Raise exceptions instead of rendering exception templates. config.action_dispatch.show_exceptions = false - # Disable request forgery protection in test environment - config.action_controller.allow_forgery_protection = false + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = 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. config.action_mailer.delivery_method = :test + # Randomize the order test cases are executed. + config.active_support.test_order = :random - # Print deprecation notices to the stderr + # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true end -- cgit v1.2.3 From 4b16c4ff2220a42a27a19230785461c6dcb74652 Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 24 Mar 2016 09:50:53 +0100 Subject: upgrade: environments:development Changed according to http://railsdiff.org/3.2.22.2/4.2.6 Also separated settings we added from those that rails has by default. --- config/environments/development.rb | 48 +++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 14 deletions(-) (limited to 'config') diff --git a/config/environments/development.rb b/config/environments/development.rb index 3c0ff0f..4112c6d 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,38 +1,58 @@ -LeapWeb::Application.configure do - # Settings specified here will take precedence over those in config/application.rb +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + ## + # DEFAULT: + # + # rails default settings in their natural order + ## # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false - # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true + # Do not eager load code on boot. + config.eager_load = false - # Show full error reports and disable caching + # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false - # Don't care if the mailer can't send + # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false - # Print deprecation notices to the Rails logger + # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log - # Only use best-standards-support built into browsers - config.action_dispatch.best_standards_support = :builtin + # Debug mode disables concatenation and preprocessing of assets. + # This option may cause significant delays in view rendering with a large + # number of complex assets. + config.assets.debug = true - # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation can not be found) - config.i18n.fallbacks = true + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true - # Do not compress assets - config.assets.compress = false + # Adds additional error checking when serving assets at runtime. + # Checks for improperly declared sprockets dependencies. + # Raises helpful error messages. + config.assets.raise_runtime_errors = true # If set to true, each asset file is loaded separately. If you are not # debugging js or css, it is much faster to set this to false. config.assets.debug = false + ## + # CUSTOM: + # + # our own settings + ## + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation can not be found) + config.i18n.fallbacks = true + # super hacky, but otherwise getting certificate error, and doesn't seem dangerous in development mode: OpenSSL::SSL.send(:remove_const, "VERIFY_PEER") OpenSSL::SSL.const_set("VERIFY_PEER", OpenSSL::SSL::VERIFY_NONE) -- cgit v1.2.3 From 464c2b463522cdb5e4577b1b9ab7ffb890788d94 Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 24 Mar 2016 11:00:06 +0100 Subject: upgrade: environments:production Changed according to http://railsdiff.org/3.2.22.2/4.2.6 Includes setting logging to debug. Not sure if we want this. I agree that it's good to have all info available in case something breaks. --- config/environments/production.rb | 70 ++++++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 27 deletions(-) (limited to 'config') diff --git a/config/environments/production.rb b/config/environments/production.rb index 7acca75..acdfc1d 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,37 +1,56 @@ -LeapWeb::Application.configure do - # Settings specified here will take precedence over those in config/application.rb +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. - # Code is not reloaded between requests + # Code is not reloaded between requests. config.cache_classes = true - # Full error reports are disabled and caching is turned on + # 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 - # Disable Rails's static asset server (Apache or nginx will already do this) - config.serve_static_assets = false - # Compress JavaScripts and CSS - config.assets.compress = true + # Dble Rack::Cache to put a simple HTTP cache in front of your application + # Add `rack-cache` to your Gemfile before enabling this. + # For large-scale production use, consider using a caching reverse proxy like + # NGINX, varnish or squid. + # config.action_dispatch.rack_cache = true + + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? + + # Compress JavaScripts and CSS. + config.assets.js_compressor = :uglifier + # config.assets.css_compressor = :sass - # Don't fallback to assets pipeline if a precompiled asset is missed + #Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false - # Generate digests for assets URLs + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. config.assets.digest = true - # Defaults to nil and saved in location specified by config.assets.prefix - # config.assets.manifest = YOUR_PATH + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb - # Specifies the header that your server uses for sending files - # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. config.force_ssl = APP_CONFIG[:force_ssl] - # See everything in the log (default is :info) - # config.log_level = :debug + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. + config.log_level = :debug + + # Prepend all log lines with the following tags. + # config.log_tags = [ :subdomain, :uuid ] # Use syslog if no file has been specified if APP_CONFIG[:logfile].blank? @@ -39,26 +58,23 @@ LeapWeb::Application.configure do config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new('webapp')) end - # Use a different cache store in production + # Use a different cache store in production. # config.cache_store = :mem_cache_store - # Enable serving of images, stylesheets, and JavaScripts from an asset server + # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = "http://assets.example.com" - # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) - # config.assets.precompile += %w( search.js ) - - # Disable delivery errors, bad email addresses will be ignored + # Ignore bad email addresses and do not raise email delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false - # Enable threaded mode - # config.threadsafe! - # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation can not be found) + # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true # Send deprecation notices to registered listeners config.active_support.deprecation = :notify + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new end -- cgit v1.2.3 From 54661746ffa9f113c6b489a4d5ba170a27874ad1 Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 24 Mar 2016 11:10:48 +0100 Subject: upgrade: migrate config environment.rb boot.rb application.rb -> adopted according to http://railsdiff.org/3.2.22.2/4.2.6 Also dropped quite_assets - not sure if this is still needed with rails 4.2. If it is we can bring it back. --- config/application.rb | 57 +++++++-------------------------------------------- config/boot.rb | 5 +---- config/environment.rb | 6 +++--- 3 files changed, 11 insertions(+), 57 deletions(-) (limited to 'config') diff --git a/config/application.rb b/config/application.rb index 4771f89..4a70b04 100644 --- a/config/application.rb +++ b/config/application.rb @@ -7,12 +7,9 @@ require "action_mailer/railtie" require "sprockets/railtie" require "rails/test_unit/railtie" -if defined?(Bundler) - # If you precompile assets before deploying to production, use this line - Bundler.require(*Rails.groups(:assets => %w(development test))) - # If you want your assets lazily compiled in production, use this line - # Bundler.require(:default, :assets, Rails.env) -end +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) APP_CONFIG = ["defaults.yml", "config.yml"].inject({}) {|config, file| filepath = File.expand_path(file, File.dirname(__FILE__)) @@ -29,16 +26,6 @@ module LeapWeb # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. - # Custom directories with classes and modules you want to be autoloadable. - # config.autoload_paths += %W(#{config.root}/extras) - - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named. - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Activate observers that should always be running. - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. # config.time_zone = 'Central Time (US & Canada)' @@ -47,48 +34,18 @@ module LeapWeb # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.default_locale = :de - # 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] - if APP_CONFIG[:logfile].present? config.logger = Logger.new(APP_CONFIG[:logfile]) end - # Enable escaping HTML in JSON. - config.active_support.escape_html_entities_in_json = true - - # Use SQL instead of Active Record's schema dumper when creating the database. - # This is necessary if your schema can't be completely dumped by the schema dumper, - # like if you have constraints or database-specific column types - # config.active_record.schema_format = :sql - - # Enforce whitelist mode for mass assignment. - # This will create an empty whitelist of attributes available for mass-assignment for all models - # in your app. As such, your models will need to explicitly whitelist or blacklist accessible - # parameters by using an attr_accessible or attr_protected declaration. - # config.active_record.whitelist_attributes = true - - ## - ## ASSETS - ## - - # Enable the asset pipeline - config.assets.enabled = true - config.assets.initialize_on_precompile = true # don't change this (see customization.rb) - - # Version of your assets, change this if you want to expire all your assets - config.assets.version = '1.0' - - # Set to false in order to see asset requests in the log - config.quiet_assets = true - ## ## CUSTOMIZATION ## see initializers/customization.rb ## + + # don't change this (see customization.rb) + config.assets.initialize_on_precompile = true + if APP_CONFIG["customization_directory"] custom_view_path = (Pathname.new(APP_CONFIG["customization_directory"]).relative_path_from(Rails.root) + 'views').to_s else diff --git a/config/boot.rb b/config/boot.rb index 4489e58..6b750f0 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,6 +1,3 @@ -require 'rubygems' - -# 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. diff --git a/config/environment.rb b/config/environment.rb index fe16a54..00a613f 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,5 +1,5 @@ -# Load the rails application +# Load the rails application. require File.expand_path('../application', __FILE__) -# Initialize the rails application -LeapWeb::Application.initialize! +# Initialize the rails application. +Rails.application.initialize! -- cgit v1.2.3 From afc1daac6745cd6b4543d2b542c6f03cfc32e1eb Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 24 Mar 2016 11:24:19 +0100 Subject: upgrade: client_side_validations initializer --- config/initializers/client_side_validations.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'config') diff --git a/config/initializers/client_side_validations.rb b/config/initializers/client_side_validations.rb index 252aded..f7a658a 100644 --- a/config/initializers/client_side_validations.rb +++ b/config/initializers/client_side_validations.rb @@ -1,9 +1,16 @@ # ClientSideValidations Initializer -# Uncomment to disable uniqueness validator, possible security issue -ClientSideValidations::Config.disabled_validators = [:uniqueness] +# Disabled validators. The uniqueness validator is disabled by default for security issues. Enable it on your own responsibility! +# ClientSideValidations::Config.disabled_validators = [:uniqueness] + +# Uncomment to validate number format with current I18n locale +# ClientSideValidations::Config.number_format_with_locale = true # Uncomment the following block if you want each input field to have the validation messages attached. +# +# Note: client_side_validation requires the error to be encapsulated within +# + ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| unless html_tag =~ /^