diff --git a/Gemfile b/Gemfile index 6c5a8e766..fdab99418 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ group :test do gem "simplecov", :require => false end -gem "rails", "3.0.7" +gem "rails", "3.1.0.rc1" gem "pg" gem "memcache-client", :require => "memcache" gem "imagesize", :require => "image_size" diff --git a/Gemfile.lock b/Gemfile.lock index 121fcb6ee..66da72374 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,8 +1,8 @@ GIT remote: http://github.com/EmmanuelOga/ffaker.git - revision: 59fb6d76c64fe93a178d3d078cebda5f78eea5cb + revision: baf4891a5351ad01775f3e4bb77c78ceed349360 specs: - ffaker (1.5.0) + ffaker (1.7.0) GIT remote: http://github.com/mislav/will_paginate.git @@ -14,92 +14,106 @@ GIT GEM remote: http://gemcutter.org/ specs: - abstract (1.0.0) - actionmailer (3.0.7) - actionpack (= 3.0.7) - mail (~> 2.2.15) - actionpack (3.0.7) - activemodel (= 3.0.7) - activesupport (= 3.0.7) - builder (~> 2.1.2) - erubis (~> 2.6.6) - i18n (~> 0.5.0) - rack (~> 1.2.1) - rack-mount (~> 0.6.14) - rack-test (~> 0.5.7) - tzinfo (~> 0.3.23) - activemodel (3.0.7) - activesupport (= 3.0.7) - builder (~> 2.1.2) - i18n (~> 0.5.0) - activerecord (3.0.7) - activemodel (= 3.0.7) - activesupport (= 3.0.7) - arel (~> 2.0.2) - tzinfo (~> 0.3.23) - activeresource (3.0.7) - activemodel (= 3.0.7) - activesupport (= 3.0.7) - activesupport (3.0.7) - arel (2.0.9) - builder (2.1.2) + actionmailer (3.1.0.rc1) + actionpack (= 3.1.0.rc1) + mail (~> 2.3.0) + actionpack (3.1.0.rc1) + activemodel (= 3.1.0.rc1) + activesupport (= 3.1.0.rc1) + builder (~> 3.0.0) + erubis (~> 2.7.0) + i18n (~> 0.6.0beta1) + rack (~> 1.3.0.beta2) + rack-cache (~> 1.0.1) + rack-mount (~> 0.8.1) + rack-test (~> 0.6.0) + sprockets (~> 2.0.0.beta.5) + tzinfo (~> 0.3.27) + activemodel (3.1.0.rc1) + activesupport (= 3.1.0.rc1) + bcrypt-ruby (~> 2.1.4) + builder (~> 3.0.0) + i18n (~> 0.6.0beta1) + activerecord (3.1.0.rc1) + activemodel (= 3.1.0.rc1) + activesupport (= 3.1.0.rc1) + arel (~> 2.1.1) + tzinfo (~> 0.3.27) + activeresource (3.1.0.rc1) + activemodel (= 3.1.0.rc1) + activesupport (= 3.1.0.rc1) + activesupport (3.1.0.rc1) + multi_json (~> 1.0) + arel (2.1.1) + bcrypt-ruby (2.1.4) + builder (3.0.0) daemons (1.1.3) delayed_job (2.1.4) activesupport (~> 3.0) daemons - erubis (2.6.6) - abstract (>= 1.0.0) + erubis (2.7.0) factory_girl (1.3.3) haml (3.1.1) - i18n (0.5.0) + hike (1.0.0) + i18n (0.6.0) imagesize (0.1.1) - mail (2.2.19) - activesupport (>= 2.3.6) + mail (2.3.0) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) mechanize (1.0.0) nokogiri (>= 1.2.1) memcache-client (1.8.5) - meta_search (1.0.4) - actionpack (~> 3.0.2) - activerecord (~> 3.0.2) - activesupport (~> 3.0.2) - arel (~> 2.0.2) + meta_search (0.5.4) + actionpack (>= 3.0.0.beta4) + activerecord (>= 3.0.0.beta4) + activesupport (>= 3.0.0.beta4) + arel (>= 0.4.0) mime-types (1.16) mocha (0.9.12) + multi_json (1.0.3) nokogiri (1.4.4) pg (0.11.0) polyglot (0.3.1) - rack (1.2.2) - rack-mount (0.6.14) + rack (1.3.0) + rack-cache (1.0.2) + rack (>= 0.4) + rack-mount (0.8.1) rack (>= 1.0.0) - rack-test (0.5.7) + rack-ssl (1.3.2) + rack + rack-test (0.6.0) rack (>= 1.0) - rails (3.0.7) - actionmailer (= 3.0.7) - actionpack (= 3.0.7) - activerecord (= 3.0.7) - activeresource (= 3.0.7) - activesupport (= 3.0.7) + rails (3.1.0.rc1) + actionmailer (= 3.1.0.rc1) + actionpack (= 3.1.0.rc1) + activerecord (= 3.1.0.rc1) + activeresource (= 3.1.0.rc1) + activesupport (= 3.1.0.rc1) bundler (~> 1.0) - railties (= 3.0.7) - railties (3.0.7) - actionpack (= 3.0.7) - activesupport (= 3.0.7) + railties (= 3.1.0.rc1) + railties (3.1.0.rc1) + actionpack (= 3.1.0.rc1) + activesupport (= 3.1.0.rc1) + rack-ssl (~> 1.3.2) rake (>= 0.8.7) - thor (~> 0.14.4) - rake (0.8.7) + thor (~> 0.14.6) + rake (0.9.0) shoulda (2.11.3) silent-postgres (0.0.8) - simple_form (1.3.1) + simple_form (1.4.0) simplecov (0.4.2) simplecov-html (~> 0.4.4) - simplecov-html (0.4.4) + simplecov-html (0.4.5) + sprockets (2.0.0.beta.8) + hike (~> 1.0) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) super_exception_notifier (3.0.13) actionmailer rake thor (0.14.6) + tilt (1.3.1) treetop (1.4.9) polyglot (>= 0.3.1) tzinfo (0.3.27) @@ -119,7 +133,7 @@ DEPENDENCIES mocha nokogiri pg - rails (= 3.0.7) + rails (= 3.1.0.rc1) shoulda silent-postgres simple_form diff --git a/config/application.rb b/config/application.rb index fadd7e529..0d168d6f6 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,37 +1,40 @@ require File.expand_path('../boot', __FILE__) + require 'rails/all' + +# If you have a Gemfile, require the gems listed there, including any gems +# you've limited to :test, :development, or :production. Bundler.require(:default, Rails.env) if defined?(Bundler) module Danbooru class Application < Rails::Application + config.encoding = "utf-8" + config.filter_parameters += [:password] + config.assets.enabled = true config.autoload_paths += %W(#{config.root}/app/presenters #{config.root}/app/logical) config.plugins = [:all] config.time_zone = 'Eastern Time (US & Canada)' - config.encoding = "utf-8" config.active_record.schema_format = :sql - config.filter_parameters << :password - config.action_view.javascript_expansions[:defaults] = [ - "src/lib/jquery-1.6.0.min.js", - "src/lib/jquery-ui-1.8.9.custom.min.js", - "src/lib/jquery.timeout.js", - "src/lib/rails.js", - "src/app/common.js", - "src/app/cookie.js", - "src/app/utility.js", - "src/app/posts.js", - "src/app/comments.js", - "src/app/uploads.js", - "src/app/users.js", - "src/app/favorites.js", - "src/app/post_flags.js", - "src/app/post_appeals.js", - "src/app/post_moderation.js", - "src/app/pools.js", - "src/app/wiki_pages.js", - "src/app/forum_posts.js", - "src/app/notes.js" - ] - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer + # config.action_view.javascript_expansions[:defaults] = [ + # "src/lib/jquery-1.6.0.min.js", + # "src/lib/jquery-ui-1.8.9.custom.min.js", + # "src/lib/jquery.timeout.js", + # "src/lib/rails.js", + # "src/app/common.js", + # "src/app/cookie.js", + # "src/app/utility.js", + # "src/app/posts.js", + # "src/app/comments.js", + # "src/app/uploads.js", + # "src/app/users.js", + # "src/app/favorites.js", + # "src/app/post_flags.js", + # "src/app/post_appeals.js", + # "src/app/post_moderation.js", + # "src/app/pools.js", + # "src/app/wiki_pages.js", + # "src/app/forum_posts.js", + # "src/app/notes.js" + # ] end end - diff --git a/config/boot.rb b/config/boot.rb index ab6cb374d..4489e5868 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,13 +1,6 @@ require 'rubygems' # Set up gems listed in the Gemfile. -gemfile = File.expand_path('../../Gemfile', __FILE__) -begin - ENV['BUNDLE_GEMFILE'] = gemfile - require 'bundler' - Bundler.setup -rescue Bundler::GemNotFound => e - STDERR.puts e.message - STDERR.puts "Try running `bundle install`." - exit! -end if File.exist?(gemfile) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) + +require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) diff --git a/config/environments/development.rb b/config/environments/development.rb index 1f99e1684..1f07c0aa4 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,9 +1,9 @@ Danbooru::Application.configure do - # Settings specified here will take precedence over those in config/environment.rb + # Settings specified here will take precedence over those in config/application.rb # 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 webserver when you make code changes. + # 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. @@ -11,7 +11,6 @@ Danbooru::Application.configure do # Show full error reports and disable caching config.consider_all_requests_local = true - config.action_view.debug_rjs = true config.action_controller.perform_caching = false # Don't care if the mailer can't send @@ -19,4 +18,7 @@ Danbooru::Application.configure do # 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 end diff --git a/config/environments/production.rb b/config/environments/production.rb index 96e18b736..3fd4a3812 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,7 +1,6 @@ Danbooru::Application.configure do - # Settings specified here will take precedence over those in config/environment.rb + # 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 config.cache_classes = true @@ -9,14 +8,19 @@ Danbooru::Application.configure do 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 both stylesheets and JavaScripts + config.assets.js_compressor = :uglifier + config.assets.css_compressor = :scss + # Specifies the header that your server uses for sending files - config.action_dispatch.x_sendfile_header = "X-Sendfile" + # (comment out if your front-end server doesn't support this) + config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx - # For nginx: - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' - - # If you have no front-end server that supports something like X-Sendfile, - # just comment this out and Rails will serve the files + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true # See everything in the log (default is :info) # config.log_level = :debug @@ -27,13 +31,12 @@ Danbooru::Application.configure do # Use a different cache store in production # config.cache_store = :mem_cache_store - # Disable Rails's static asset server - # In production, Apache or nginx will already do this - config.serve_static_assets = false - - # 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 # config.action_mailer.raise_delivery_errors = false diff --git a/config/environments/test.rb b/config/environments/test.rb index c235b3a9b..959da24b9 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,5 +1,5 @@ Danbooru::Application.configure do - # Settings specified here will take precedence over those in config/environment.rb + # 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,7 +7,11 @@ Danbooru::Application.configure do # and recreated between test runs. Don't rely on the data there! config.cache_classes = true - # Log error messages when you accidentally call methods on nil. + # Configure static asset server for tests with Cache-Control for performance + config.serve_static_assets = true + config.static_cache_control = "public, max-age=3600" + + # Log error messages when you accidentally call methods on nil config.whiny_nils = true # Show full error reports and disable caching diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index f2525ce89..9e8b0131f 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,3 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format +# (all these examples are active by default): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index e60fade84..1d6eea98d 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,8 +1,8 @@ # Be sure to restart your server when you modify this file. -Danbooru::Application.config.session_store :cookie_store, :key => '_config_session' +Danbooru::Application.config.session_store :cookie_store, key: '_danbooru_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information -# (create the session table with "rake db:sessions:create") -# Config::Application.config.session_store :active_record_store +# (create the session table with "rails generate session_migration") +# Danbooru::Application.config.session_store :active_record_store diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb new file mode 100644 index 000000000..c66629f84 --- /dev/null +++ b/config/initializers/wrap_parameters.rb @@ -0,0 +1,12 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains the settings for ActionController::ParametersWrapper +# which will be enabled by default in the upcoming version of Ruby on Rails. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActionController::Base.wrap_parameters format: [:json] + +# Disable root element in JSON by default. +if defined?(ActiveRecord) + ActiveRecord::Base.include_root_in_json = false +end diff --git a/config/locales/en.yml b/config/locales/en.yml index a747bfa69..179c14ca5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,5 +1,5 @@ # Sample localization file for English. Add more files in this directory for other locales. -# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. +# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. en: hello: "Hello world"