From: Tom Hughes Date: Sat, 20 Dec 2014 15:08:16 +0000 (+0000) Subject: Update to rails 4.2.0 X-Git-Tag: live~4862^2~7 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/e65e41a6942062ff044af0d31c41ca0e554343cc Update to rails 4.2.0 --- diff --git a/Gemfile b/Gemfile index 51e8b49a4..e59705dad 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' # Require rails -gem 'rails', '4.1.9' +gem 'rails', '4.2.0' # Require things which have moved to gems in ruby 1.9 gem 'bigdecimal', "~> 1.1.0", :platforms => :ruby_19 @@ -16,19 +16,19 @@ gem 'json' gem 'pg' # Use SCSS for stylesheets -gem 'sass-rails', '~> 4.0.3' +gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # Use CoffeeScript for .js.coffee assets and views -gem 'coffee-rails', '~> 4.0.0' +gem 'coffee-rails', '~> 4.1.0' # Use jquery as the JavaScript library gem 'jquery-rails' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder -# gem 'jbuilder', '~> 1.2' +# gem 'jbuilder', '~> 2.0' gem 'jsonify-rails' # Use R2 for RTL conversion @@ -44,7 +44,7 @@ gem 'rinku', '>= 1.2.2', :require => 'rails_rinku' gem 'oauth-plugin', '>= 0.5.1' gem 'open_id_authentication', '>= 1.1.0' gem 'validates_email_format_of', '>= 1.5.1' -gem 'composite_primary_keys', '~> 7.0.11' +gem 'composite_primary_keys', '~> 8.0.0' gem 'http_accept_language', '~> 2.0.0' gem 'paperclip', '~> 4.0' gem 'deadlock_retry', '>= 1.2.0' diff --git a/Gemfile.lock b/Gemfile.lock index 6a23c766c..fee72773e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,35 +2,44 @@ GEM remote: https://rubygems.org/ specs: SystemTimer (1.2.3) - actionmailer (4.1.9) - actionpack (= 4.1.9) - actionview (= 4.1.9) + actionmailer (4.2.0) + actionpack (= 4.2.0) + actionview (= 4.2.0) + activejob (= 4.2.0) mail (~> 2.5, >= 2.5.4) - actionpack (4.1.9) - actionview (= 4.1.9) - activesupport (= 4.1.9) - rack (~> 1.5.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.0) + actionview (= 4.2.0) + activesupport (= 4.2.0) + rack (~> 1.6.0) rack-test (~> 0.6.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.1) actionpack-page_caching (1.0.2) actionpack (>= 4.0.0, < 5) - actionview (4.1.9) - activesupport (= 4.1.9) + actionview (4.2.0) + activesupport (= 4.2.0) builder (~> 3.1) erubis (~> 2.7.0) - activemodel (4.1.9) - activesupport (= 4.1.9) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.1) + activejob (4.2.0) + activesupport (= 4.2.0) + globalid (>= 0.3.0) + activemodel (4.2.0) + activesupport (= 4.2.0) builder (~> 3.1) - activerecord (4.1.9) - activemodel (= 4.1.9) - activesupport (= 4.1.9) - arel (~> 5.0.0) - activesupport (4.1.9) - i18n (~> 0.6, >= 0.6.9) + activerecord (4.2.0) + activemodel (= 4.2.0) + activesupport (= 4.2.0) + arel (~> 6.0) + activesupport (4.2.0) + i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) - thread_safe (~> 0.1) + thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - arel (5.0.1.20140414130214) + arel (6.0.0) autoprefixer-rails (4.0.2.2) execjs bigdecimal (1.1.0) @@ -46,7 +55,7 @@ GEM cliver (0.3.2) cocaine (0.5.5) climate_control (>= 0.0.3, < 1.0) - coffee-rails (4.0.1) + coffee-rails (4.1.0) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) coffee-script (2.3.0) @@ -54,8 +63,8 @@ GEM execjs coffee-script-source (1.8.0) colorize (0.7.5) - composite_primary_keys (7.0.12) - activerecord (~> 4.1.7) + composite_primary_keys (8.0.0) + activerecord (~> 4.2.0) crass (1.0.1) dalli (2.7.2) deadlock_retry (1.2.0) @@ -64,16 +73,19 @@ GEM execjs (2.2.2) faraday (0.9.1) multipart-post (>= 1.2, < 3) + globalid (0.3.0) + activesupport (>= 4.1.0) hike (1.2.3) htmlentities (4.3.3) http_accept_language (2.0.2) httpclient (2.6.0.1) i18n (0.7.0) iconv (0.1) - jquery-rails (3.1.2) - railties (>= 3.0, < 5.0) + jquery-rails (4.0.3) + rails-dom-testing (~> 1.0) + railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (1.8.1) + json (1.8.2) jsonify (0.3.1) multi_json (~> 1.0) jsonify-rails (0.3.2) @@ -87,12 +99,14 @@ GEM colorize railties (>= 3.1, < 5) sprockets - libxml-ruby (2.7.0) + libxml-ruby (2.8.0) + loofah (2.0.1) + nokogiri (>= 1.5.9) mail (2.6.3) mime-types (>= 1.16, < 3) mime-types (2.4.3) mini_portile (0.6.2) - minitest (5.5.0) + minitest (5.5.1) multi_json (1.10.1) multi_xml (0.5.5) multipart-post (2.0.0) @@ -127,31 +141,40 @@ GEM cliver (~> 0.3.1) multi_json (~> 1.0) websocket-driver (>= 0.2.0) - psych (2.0.8) + psych (2.0.9) r2 (0.2.5) - rack (1.5.2) + rack (1.6.0) rack-cors (0.3.1) rack-openid (1.4.2) rack (>= 1.1.0) ruby-openid (>= 2.1.8) - rack-test (0.6.2) + rack-test (0.6.3) rack (>= 1.0) - rails (4.1.9) - actionmailer (= 4.1.9) - actionpack (= 4.1.9) - actionview (= 4.1.9) - activemodel (= 4.1.9) - activerecord (= 4.1.9) - activesupport (= 4.1.9) + rails (4.2.0) + actionmailer (= 4.2.0) + actionpack (= 4.2.0) + actionview (= 4.2.0) + activejob (= 4.2.0) + activemodel (= 4.2.0) + activerecord (= 4.2.0) + activesupport (= 4.2.0) bundler (>= 1.3.0, < 2.0) - railties (= 4.1.9) - sprockets-rails (~> 2.0) + railties (= 4.2.0) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.5) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6.0) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.1) + loofah (~> 2.0) rails-i18n (4.0.3) i18n (~> 0.6) railties (~> 4.0) - railties (4.1.9) - actionpack (= 4.1.9) - activesupport (= 4.1.9) + railties (4.2.0) + actionpack (= 4.2.0) + activesupport (= 4.2.0) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (10.4.2) @@ -162,12 +185,13 @@ GEM crass (~> 1.0.1) nokogiri (>= 1.4.4) nokogumbo (= 1.2.0) - sass (3.2.19) - sass-rails (4.0.5) + sass (3.4.9) + sass-rails (5.0.1) railties (>= 4.0.0, < 5.0) - sass (~> 3.2.2) - sprockets (~> 2.8, < 3.0) - sprockets-rails (~> 2.0) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) + sprockets-rails (>= 2.0, < 4.0) + tilt (~> 1.1) soap4r-ruby1.9 (2.0.5) sprockets (2.12.3) hike (~> 1.2) @@ -184,7 +208,7 @@ GEM timecop (0.7.1) tzinfo (1.2.2) thread_safe (~> 0.1) - uglifier (2.6.1) + uglifier (2.7.0) execjs (>= 0.3.0) json (>= 1.8.0) validates_email_format_of (1.6.1) @@ -204,8 +228,8 @@ DEPENDENCIES actionpack-page_caching autoprefixer-rails bigdecimal (~> 1.1.0) - coffee-rails (~> 4.0.0) - composite_primary_keys (~> 7.0.11) + coffee-rails (~> 4.1.0) + composite_primary_keys (~> 8.0.0) dalli deadlock_retry (>= 1.2.0) dynamic_form @@ -229,13 +253,13 @@ DEPENDENCIES psych r2 rack-cors - rails (= 4.1.9) + rails (= 4.2.0) rails-i18n (~> 4.0.0) redcarpet rinku (>= 1.2.2) ruby-openid (>= 2.2.0) sanitize - sass-rails (~> 4.0.3) + sass-rails (~> 5.0) soap4r-ruby1.9 timecop uglifier (>= 1.3.0) diff --git a/Rakefile b/Rakefile index 039e38f47..28fdc4c57 100644 --- a/Rakefile +++ b/Rakefile @@ -2,6 +2,5 @@ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require File.expand_path('../config/application', __FILE__) -require 'rake' OpenStreetMap::Application.load_tasks diff --git a/config.ru b/config.ru index 5bc2a619e..bd83b2541 100644 --- a/config.ru +++ b/config.ru @@ -1,4 +1,4 @@ # This file is used by Rack-based servers to start the application. -require ::File.expand_path('../config/environment', __FILE__) +require ::File.expand_path('../config/environment', __FILE__) run Rails.application diff --git a/config/application.rb b/config/application.rb index a40336c33..6a96b9dd6 100644 --- a/config/application.rb +++ b/config/application.rb @@ -30,6 +30,9 @@ module OpenStreetMap # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.default_locale = :de + # Do not swallow errors in after_commit/after_rollback callbacks. + config.active_record.raise_in_transactional_callbacks = true + # Custom directories with classes and modules you want to be autoloadable. config.autoload_paths += %W(#{config.root}/lib) diff --git a/config/boot.rb b/config/boot.rb index 5e5f0c1fa..6b750f00b 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,4 +1,3 @@ -# Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/config/environments/development.rb b/config/environments/development.rb index 103b920f5..01466ae75 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -29,6 +29,10 @@ OpenStreetMap::Application.configure do # number of complex assets. config.assets.debug = 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 + # Adds additional error checking when serving assets at runtime. # Checks for improperly declared sprockets dependencies. # Raises helpful error messages. diff --git a/config/environments/production.rb b/config/environments/production.rb index 941070902..f0634b3cb 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -16,11 +16,13 @@ OpenStreetMap::Application.configure do # Enable 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. + # For large-scale production use, consider using a caching reverse proxy like + # NGINX, varnish or squid. # config.action_dispatch.rack_cache = true - # Disable Rails's static asset server (Apache or nginx will already do this). - config.serve_static_assets = false + # 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 @@ -29,18 +31,22 @@ OpenStreetMap::Application.configure do # 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 + # `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 + # 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 = true - # Set to :debug to see everything in the log. - config.log_level = :info + # 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 ] @@ -62,24 +68,19 @@ OpenStreetMap::Application.configure do config.action_controller.page_cache_directory = Rails.public_path # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = "http://assets.example.com" - - # `config.assets.precompile` has moved to config/initializers/assets.rb + # config.action_controller.asset_host = 'http://assets.example.com' # 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 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 - # Disable automatic flushing of the log to improve performance. - # config.autoflush_log = false - # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new diff --git a/config/environments/test.rb b/config/environments/test.rb index b0ff645a0..3c8b55457 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -12,8 +12,8 @@ OpenStreetMap::Application.configure do # preloads Rails for running tests, you may have to set it to true. config.eager_load = false - # Configure static asset server for tests with Cache-Control for performance. - config.serve_static_assets = true + # Configure static file 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. @@ -31,6 +31,9 @@ OpenStreetMap::Application.configure do # 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. config.active_support.deprecation = :stderr diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 9560e2979..df86f2b9d 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -3,6 +3,9 @@ # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' +# Add additional assets to the asset load path +# Rails.application.config.assets.paths << Emoji.images_path + # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. Rails.application.config.assets.precompile += %w( index.js browse.js welcome.js fixthemap.js ) diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb index 7a06a89f0..7f70458de 100644 --- a/config/initializers/cookies_serializer.rb +++ b/config/initializers/cookies_serializer.rb @@ -1,3 +1,3 @@ # Be sure to restart your server when you modify this file. -Rails.application.config.action_dispatch.cookies_serializer = :json \ No newline at end of file +Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index be247274f..576da5285 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -2,6 +2,5 @@ # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf -# Mime::Type.register_alias "text/html", :iphone Mime::Type.register "application/x-amf", :amf Mime::Type.register "application/gpx+xml", :gpx diff --git a/config/initializers/postgresql_adapter.rb b/config/initializers/postgresql_adapter.rb deleted file mode 100644 index 9dcc34fcc..000000000 --- a/config/initializers/postgresql_adapter.rb +++ /dev/null @@ -1,34 +0,0 @@ -if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) - module ActiveRecord - module ConnectionAdapters - class PostgreSQLAdapter - def initialize_type_map_with_enums(type_map) - OID.alias_type "format_enum", "text" - OID.alias_type "gpx_visibility_enum", "text" - OID.alias_type "note_status_enum", "text" - OID.alias_type "note_event_enum", "text" - OID.alias_type "nwr_enum", "text" - OID.alias_type "user_role_enum", "text" - OID.alias_type "user_status_enum", "text" - - initialize_type_map_without_enums(type_map) - end - - alias_method_chain :initialize_type_map, :enums - end - - class PostgreSQLColumn - def simplified_type_with_enum(field_type) - case field_type - when /_enum$/ - :string - else - simplified_type_without_enum(field_type) - end - end - - alias_method_chain :simplified_type, :enum - end - end - end -end