From 0cabaea043695826a4b3e14f895a6adc4eebdc72 Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Wed, 9 Apr 2014 09:02:20 +0200 Subject: [PATCH] Update rails to version 4.1.0 --- Gemfile | 6 +- Gemfile.lock | 75 +++++++++++++---------- Rakefile | 2 +- app/assets/stylesheets/application.css | 6 +- bin/rails | 4 ++ bin/rake | 4 ++ bin/spring | 18 ++++++ config/application.rb | 2 +- config/environment.rb | 2 +- config/environments/development.rb | 12 +++- config/environments/production.rb | 9 ++- config/environments/test.rb | 5 +- config/initializers/cookies_serializer.rb | 3 + config/initializers/mime_types.rb | 1 - config/initializers/session_store.rb | 2 +- config/routes.rb | 2 +- config/secrets.yml | 22 +++++++ public/404.html | 31 ++++++---- public/422.html | 31 ++++++---- public/500.html | 29 ++++++--- public/robots.txt | 2 +- test/test_helper.rb | 2 +- 22 files changed, 187 insertions(+), 83 deletions(-) create mode 100755 bin/spring create mode 100644 config/initializers/cookies_serializer.rb create mode 100644 config/secrets.yml diff --git a/Gemfile b/Gemfile index 16e0e2f..cbaae9c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' ruby '2.1.1' -gem 'rails', '~> 4.0.4' +gem 'rails', '~> 4.1.0' gem 'arel' gem 'devise' @@ -23,6 +23,10 @@ group :assets do gem 'uglifier' end +group :development do + gem 'spring' +end + group :development, :test do gem 'pry' end diff --git a/Gemfile.lock b/Gemfile.lock index e056aff..6775cf5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,35 +1,37 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.0.4) - actionpack (= 4.0.4) + actionmailer (4.1.0) + actionpack (= 4.1.0) + actionview (= 4.1.0) mail (~> 2.5.4) - actionpack (4.0.4) - activesupport (= 4.0.4) - builder (~> 3.1.0) - erubis (~> 2.7.0) + actionpack (4.1.0) + actionview (= 4.1.0) + activesupport (= 4.1.0) rack (~> 1.5.2) rack-test (~> 0.6.2) - activemodel (4.0.4) - activesupport (= 4.0.4) - builder (~> 3.1.0) - activerecord (4.0.4) - activemodel (= 4.0.4) - activerecord-deprecated_finders (~> 1.0.2) - activesupport (= 4.0.4) - arel (~> 4.0.0) - activerecord-deprecated_finders (1.0.3) - activesupport (4.0.4) + actionview (4.1.0) + activesupport (= 4.1.0) + builder (~> 3.1) + erubis (~> 2.7.0) + activemodel (4.1.0) + activesupport (= 4.1.0) + builder (~> 3.1) + activerecord (4.1.0) + activemodel (= 4.1.0) + activesupport (= 4.1.0) + arel (~> 5.0.0) + activesupport (4.1.0) i18n (~> 0.6, >= 0.6.9) - minitest (~> 4.2) - multi_json (~> 1.3) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) thread_safe (~> 0.1) - tzinfo (~> 0.3.37) + tzinfo (~> 1.1) addressable (2.3.6) - arel (4.0.2) + arel (5.0.0) ast (1.1.0) bcrypt (3.1.7) - builder (3.1.4) + builder (3.2.2) coderay (1.1.0) coffee-rails (4.0.1) coffee-script (>= 2.2.0) @@ -80,7 +82,7 @@ GEM method_source (0.8.2) mime-types (1.25.1) mini_portile (0.5.3) - minitest (4.7.5) + minitest (5.3.2) multi_json (1.9.2) nested_form (0.3.2) nokogiri (1.6.1) @@ -104,14 +106,16 @@ GEM rack (~> 1.3) rack-test (0.6.2) rack (>= 1.0) - rails (4.0.4) - actionmailer (= 4.0.4) - actionpack (= 4.0.4) - activerecord (= 4.0.4) - activesupport (= 4.0.4) + rails (4.1.0) + actionmailer (= 4.1.0) + actionpack (= 4.1.0) + actionview (= 4.1.0) + activemodel (= 4.1.0) + activerecord (= 4.1.0) + activesupport (= 4.1.0) bundler (>= 1.3.0, < 2.0) - railties (= 4.0.4) - sprockets-rails (~> 2.0.0) + railties (= 4.1.0) + sprockets-rails (~> 2.0) rails_12factor (0.0.2) rails_serve_static_assets rails_stdout_logging @@ -131,9 +135,9 @@ GEM sass-rails (~> 4.0) rails_serve_static_assets (0.0.2) rails_stdout_logging (0.0.3) - railties (4.0.4) - actionpack (= 4.0.4) - activesupport (= 4.0.4) + railties (4.1.0) + actionpack (= 4.1.0) + activesupport (= 4.1.0) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (2.0.0) @@ -160,6 +164,7 @@ GEM simplecov-html (~> 0.8.0) simplecov-html (0.8.0) slop (3.5.0) + spring (1.1.2) sprockets (2.11.0) hike (~> 1.2) multi_json (~> 1.0) @@ -179,7 +184,8 @@ GEM treetop (1.4.15) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.39) + tzinfo (1.1.0) + thread_safe (~> 0.1) uglifier (2.5.0) execjs (>= 0.3.0) json (>= 1.8.0) @@ -206,12 +212,13 @@ DEPENDENCIES pg pry puma - rails (~> 4.0.4) + rails (~> 4.1.0) rails_12factor rails_admin rubocop sass-rails simplecov + spring sqlite3 uglifier validates_formatting_of diff --git a/Rakefile b/Rakefile index 5a4d7c2..ba6b733 100644 --- a/Rakefile +++ b/Rakefile @@ -3,4 +3,4 @@ require File.expand_path('../config/application', __FILE__) -AdoptAThing::Application.load_tasks +Rails.application.load_tasks diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 3192ec8..dce151f 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -5,8 +5,10 @@ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. * - * You're free to add application-wide styles to this file and they'll appear at the top of the - * compiled file, but it's generally better to create a new file per style scope. + * You're free to add application-wide styles to this file and they'll appear at the bottom of the + * compiled file so the styles you add here take precedence over styles defined in any styles + * defined in the other CSS/SCSS files in this directory. It is generally better to create a new + * file per style scope. * *= require_self *= require_tree . diff --git a/bin/rails b/bin/rails index 728cd85..7feb6a3 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,8 @@ #!/usr/bin/env ruby +begin + load File.expand_path("../spring", __FILE__) +rescue LoadError +end APP_PATH = File.expand_path('../../config/application', __FILE__) require_relative '../config/boot' require 'rails/commands' diff --git a/bin/rake b/bin/rake index 1724048..8017a02 100755 --- a/bin/rake +++ b/bin/rake @@ -1,4 +1,8 @@ #!/usr/bin/env ruby +begin + load File.expand_path("../spring", __FILE__) +rescue LoadError +end require_relative '../config/boot' require 'rake' Rake.application.run diff --git a/bin/spring b/bin/spring new file mode 100755 index 0000000..253ec37 --- /dev/null +++ b/bin/spring @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby + +# This file loads spring without using Bundler, in order to be fast +# It gets overwritten when you run the `spring binstub` command + +unless defined?(Spring) + require "rubygems" + require "bundler" + + if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ spring \((.*?)\)$.*?^$/m) + ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR) + ENV["GEM_HOME"] = "" + Gem.paths = ENV + + gem "spring", match[1] + require "spring/binstub" + end +end diff --git a/config/application.rb b/config/application.rb index d62d316..243e698 100644 --- a/config/application.rb +++ b/config/application.rb @@ -4,7 +4,7 @@ require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. -Bundler.require(:default, Rails.env) +Bundler.require(*Rails.groups) module AdoptAThing class Application < Rails::Application diff --git a/config/environment.rb b/config/environment.rb index d0bf34d..ee8d90d 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -2,4 +2,4 @@ require File.expand_path('../application', __FILE__) # Initialize the Rails application. -AdoptAThing::Application.initialize! +Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index f264039..4ec7cb1 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,4 +1,4 @@ -AdoptAThing::Application.configure do +Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on @@ -20,11 +20,19 @@ AdoptAThing::Application.configure do # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log - # Raise an error on page load if there are pending migrations + # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # 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 + + # 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 + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true end diff --git a/config/environments/production.rb b/config/environments/production.rb index 83caf1f..02690a9 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,11 +1,11 @@ -AdoptAThing::Application.configure do +Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and - # your application in memory, allowing both thread web servers + # 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 @@ -68,7 +68,7 @@ AdoptAThing::Application.configure do config.action_mailer.default_url_options = {host: 'adoptahydrant.org'} # 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. @@ -79,6 +79,9 @@ AdoptAThing::Application.configure do # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new + + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false end ActionMailer::Base.smtp_settings = { diff --git a/config/environments/test.rb b/config/environments/test.rb index f0bf798..a2de27d 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,4 +1,4 @@ -AdoptAThing::Application.configure do +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 @@ -34,4 +34,7 @@ AdoptAThing::Application.configure do # 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 diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb new file mode 100644 index 0000000..7a06a89 --- /dev/null +++ b/config/initializers/cookies_serializer.rb @@ -0,0 +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 diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index 72aca7e..dc18996 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -2,4 +2,3 @@ # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf -# Mime::Type.register_alias "text/html", :iphone diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index 7f97dc9..dc11565 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,3 +1,3 @@ # Be sure to restart your server when you modify this file. -AdoptAThing::Application.config.session_store :cookie_store, key: '_adopt-a-thing_session' +Rails.application.config.session_store :cookie_store, key: '_adopt-a-hydrant_session' diff --git a/config/routes.rb b/config/routes.rb index 1771367..1cf6843 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,4 @@ -AdoptAThing::Application.routes.draw do +Rails.application.routes.draw do devise_for :users, controllers: { passwords: 'passwords', registrations: 'users', diff --git a/config/secrets.yml b/config/secrets.yml new file mode 100644 index 0000000..e272869 --- /dev/null +++ b/config/secrets.yml @@ -0,0 +1,22 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rake secret` to generate a secure secret key. + +# Make sure the secrets in this file are kept private +# if you're sharing your code publicly. + +development: + secret_key_base: 0e16faa4e63cf660f77d2b01b3eea1cf05d92cc2550dd5c6bcdd6c428cacd9ed82cf420376130716e8ce890490cfdb9d30241f12d0043ef1c2356e0ee22c031b + +test: + secret_key_base: de935ed2ec52cc94165a0542fd3fc2aefc5eb56557b31d6333adb15fe413a2ae89b02ffd402b7fc2279dcd9fbcb45f6c4c764937665f0c61abbbf2bf5c70e967 + +# Do not keep production secrets in the repository, +# instead read values from the environment. +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> diff --git a/public/404.html b/public/404.html index a0daa0c..b612547 100644 --- a/public/404.html +++ b/public/404.html @@ -2,17 +2,23 @@ The page you were looking for doesn't exist (404) + @@ -50,9 +57,11 @@
-

The page you were looking for doesn't exist.

-

You may have mistyped the address or the page may have moved.

+
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+

If you are the application owner check the logs for more information.

-

If you are the application owner check the logs for more information.

diff --git a/public/422.html b/public/422.html index fbb4b84..a21f82b 100644 --- a/public/422.html +++ b/public/422.html @@ -2,17 +2,23 @@ The change you wanted was rejected (422) + @@ -50,9 +57,11 @@
-

The change you wanted was rejected.

-

Maybe you tried to change something you didn't have access to.

+
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+

If you are the application owner check the logs for more information.

-

If you are the application owner check the logs for more information.

diff --git a/public/500.html b/public/500.html index e9052d3..061abc5 100644 --- a/public/500.html +++ b/public/500.html @@ -2,17 +2,23 @@ We're sorry, but something went wrong (500) + @@ -50,8 +57,10 @@
-

We're sorry, but something went wrong.

+
+

We're sorry, but something went wrong.

+
+

If you are the application owner check the logs for more information.

-

If you are the application owner check the logs for more information.

diff --git a/public/robots.txt b/public/robots.txt index 1a3a5e4..3c9c7c0 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,4 +1,4 @@ -# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file +# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file # # To ban all spiders from the entire site uncomment the next two lines: # User-agent: * diff --git a/test/test_helper.rb b/test/test_helper.rb index 3e7e38e..488e7ac 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,4 +1,4 @@ -ENV['RAILS_ENV'] = 'test' +ENV['RAILS_ENV'] ||= 'test' require 'simplecov' require 'coveralls'