Permalink
Browse files

Updated environment config for Rails 3.1, got rid of some crap

  • Loading branch information...
1 parent eb39242 commit 8fe213d76016b3e6e2e48eca4ee72325e6d82c47 @elektronaut elektronaut committed Sep 28, 2011
Showing with 66 additions and 114 deletions.
  1. +36 −37 config/environments/production.rb
  2. +30 −25 config/environments/test.rb
  3. +0 −22 config/preinitializer.rb
  4. +0 −30 config/setup_load_paths.rb
@@ -1,59 +1,58 @@
# encoding: utf-8
Sugar::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
+ # Code is not reloaded between requests
+ config.cache_classes = true
- # Full error reports are disabled and caching is turned on
- config.consider_all_requests_local = false
- config.action_controller.perform_caching = true
+ # Full error reports are disabled and caching is turned on
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
- # Specifies the header that your server uses for sending files
- config.action_dispatch.x_sendfile_header = "X-Sendfile"
+ # Disable Rails's static asset server (Apache or nginx will already do this)
+ config.serve_static_assets = false
- # For nginx:
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
+ # Compress JavaScripts and CSS
+ config.assets.compress = true
- # If you have no front-end server that supports something like X-Sendfile,
- # just comment this out and Rails will serve the files
+ # Specify the default JavaScript compressor
+ config.assets.js_compressor = :uglifier
- # See everything in the log (default is :info)
- # config.log_level = :debug
+ # Specifies the header that your server uses for sending files
+ # (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
- # Use a different logger for distributed setups
- # config.logger = SyslogLogger.new
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
+ # config.force_ssl = true
- # Use a different cache store in production
- # config.cache_store = :mem_cache_store
+ # See everything in the log (default is :info)
+ # config.log_level = :debug
- # Disable Rails's static asset server
- # In production, Apache or nginx will already do this
- config.serve_static_assets = false
+ # Use a different logger for distributed setups
+ # config.logger = SyslogLogger.new
- # Compress JavaScripts and CSS
- config.assets.compress = true
+ # Use a different cache store in production
+ # config.cache_store = :mem_cache_store
- # Specify the default JavaScript compressor
- config.assets.js_compressor = :uglifier
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
+ # config.action_controller.asset_host = "http://assets.example.com"
- # 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
+ # Disable delivery errors, bad email addresses will be ignored
+ # config.action_mailer.raise_delivery_errors = false
- # Enable threaded mode
- # config.threadsafe!
+ # 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)
- config.i18n.fallbacks = 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
- # Send deprecation notices to registered listeners
- config.active_support.deprecation = :notify
+ # Send deprecation notices to registered listeners
+ config.active_support.deprecation = :notify
# Store all page caches in a subfolder of public
config.action_controller.page_cache_directory = File.join(File.dirname(__FILE__), '../../public/cache')
@@ -1,37 +1,42 @@
# encoding: utf-8
Sugar::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
- # your test database is "scratch space" for the test suite and is wiped
- # and recreated between test runs. Don't rely on the data there!
- config.cache_classes = true
+ # The test environment is used exclusively to run your application's
+ # test suite. You never need to work with it otherwise. Remember that
+ # your test database is "scratch space" for the test suite and is wiped
+ # 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.
- config.whiny_nils = 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"
- # Show full error reports and disable caching
- config.consider_all_requests_local = true
- config.action_controller.perform_caching = false
+ # Log error messages when you accidentally call methods on nil
+ config.whiny_nils = true
- # Raise exceptions instead of rendering exception templates
- config.action_dispatch.show_exceptions = false
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
- # Disable request forgery protection in test environment
- config.action_controller.allow_forgery_protection = false
+ # Raise exceptions instead of rendering exception templates
+ config.action_dispatch.show_exceptions = 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
+ # Disable request forgery protection in test environment
+ config.action_controller.allow_forgery_protection = false
- # Use SQL instead of Active Record's schema dumper when creating the test 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
+ # 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
+
+ # Use SQL instead of Active Record's schema dumper when creating the test 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
+
+ # Print deprecation notices to the stderr
+ config.active_support.deprecation = :stderr
- # Print deprecation notices to the stderr
- config.active_support.deprecation = :stderr
end
View
@@ -1,22 +0,0 @@
-# encoding: utf-8
-
-begin
- require "rubygems"
- require "bundler"
-rescue LoadError
- raise "Could not load the bundler gem. Install it with `gem install bundler`."
-end
-
-if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
- raise RuntimeError, "Your bundler version is too old for Rails 2.3." +
- "Run `gem install bundler` to upgrade."
-end
-
-begin
- # Set up load paths for all bundled gems
- ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
- Bundler.setup
-rescue Bundler::GemNotFound
- raise RuntimeError, "Bundler couldn't find some gems." +
- "Did you run `bundle install`?"
-end
View
@@ -1,30 +0,0 @@
-# encoding: utf-8
-
-if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
- begin
- rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))
- rvm_lib_path = File.join(rvm_path, 'lib')
- $LOAD_PATH.unshift rvm_lib_path
- require 'rvm'
- RVM.use_from_path! File.dirname(File.dirname(__FILE__))
- rescue LoadError
- # RVM is unavailable at this point.
- raise "RVM ruby lib is currently unavailable."
- end
-end
-
-# Select the correct item for which you use below.
-# If you're not using bundler, remove it completely.
-
-# If we're using a Bundler 1.0 beta
-ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', File.dirname(__FILE__))
-require 'bundler/setup'
-
-# Or Bundler 0.9...
-if File.exist?(".bundle/environment.rb")
- require '.bundle/environment'
-else
- require 'rubygems'
- require 'bundler'
- Bundler.setup
-end

0 comments on commit 8fe213d

Please sign in to comment.