Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidated and better commented the environment files
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
- Loading branch information
Showing
5 changed files
with
88 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
ActiveRecord::Base.logger = ActionController::Base.logger = ActionMailer::Base.logger = Logger.new("#{RAILS_ROOT}/log/development.log") | ||
ActiveRecord::Base.establish_connection(:development) | ||
ActionController::Base.consider_all_requests_local = true | ||
ActionController::Base.reload_dependencies = true | ||
ActiveRecord::Base.reload_associations = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
ActiveRecord::Base.logger = ActionController::Base.logger = ActionMailer::Base.logger = Logger.new("#{RAILS_ROOT}/log/production.log") | ||
ActiveRecord::Base.establish_connection(:production) | ||
|
||
ActionController::Base.consider_all_requests_local = false | ||
ActionController::Base.reload_dependencies = false | ||
ActiveRecord::Base.reload_associations = false | ||
ActiveRecord::Base.reload_associations = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,56 @@ | ||
RAILS_ROOT = File.expand_path(File.dirname(__FILE__) + "/../") | ||
RAILS_ENV = ENV['RAILS_ENV'] || 'development' | ||
|
||
ADDITIONAL_LOAD_PATHS = [ | ||
"app/models", | ||
"app/controllers", | ||
"app/helpers", | ||
"app", | ||
"config", | ||
"lib", | ||
"vendor", | ||
"vendor/railties", | ||
"vendor/railties/lib", | ||
"vendor/activerecord/lib", | ||
"vendor/actionpack/lib", | ||
"vendor/actionmailer/lib", | ||
] | ||
|
||
ADDITIONAL_LOAD_PATHS.unshift(Dir["#{RAILS_ROOT}/app/models/[a-z]*"].collect{ |dir| "app/models/#{File.basename(dir)}" }) | ||
ADDITIONAL_LOAD_PATHS.unshift("test/mocks/#{RAILS_ENV}") | ||
|
||
ADDITIONAL_LOAD_PATHS.flatten.each { |dir| $: << "#{RAILS_ROOT}/#{dir}" } | ||
|
||
|
||
# Mocks first. | ||
ADDITIONAL_LOAD_PATHS = ["#{RAILS_ROOT}/test/mocks/#{RAILS_ENV}"] | ||
|
||
# Then model subdirectories. | ||
ADDITIONAL_LOAD_PATHS.concat(Dir["#{RAILS_ROOT}/app/models/[a-z]*"]) | ||
|
||
# Followed by the standard includes. | ||
ADDITIONAL_LOAD_PATHS.concat %w( | ||
app/models | ||
app/controllers | ||
app/helpers | ||
app | ||
config | ||
lib | ||
vendor | ||
vendor/railties | ||
vendor/railties/lib | ||
vendor/activerecord/lib | ||
vendor/actionpack/lib | ||
vendor/actionmailer/lib | ||
).map { |dir| "#{RAILS_ROOT}/#{dir}" } | ||
|
||
# Prepend to $LOAD_PATH | ||
ADDITIONAL_LOAD_PATHS.reverse.each do |dir| | ||
$:.unshift(dir) if File.directory?(dir) | ||
end | ||
|
||
|
||
# Require Rails libraries. | ||
require 'active_record' | ||
require 'action_controller' | ||
require 'action_mailer' | ||
|
||
require 'yaml' | ||
|
||
ActionController::Base.template_root = ActionMailer::Base.template_root = "#{RAILS_ROOT}/app/views/" | ||
# Environment-specific configuration. | ||
require 'yaml' | ||
ActiveRecord::Base.configurations = YAML::load(File.open("#{RAILS_ROOT}/config/database.yml")) | ||
|
||
ActionController::Base.require_or_load 'abstract_application' | ||
ActionController::Base.require_or_load "environments/#{RAILS_ENV}" | ||
ActionController::Base.require_or_load "environments/#{RAILS_ENV}" | ||
|
||
|
||
# Configure defaults if the included environment did not. | ||
RAILS_DEFAULT_LOGGER = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log") | ||
[ActiveRecord::Base, ActionController::Base, ActionMailer::Base].each do |klass| | ||
klass.logger ||= RAILS_DEFAULT_LOGGER | ||
end | ||
[ActionController::Base, ActionMailer::Base].each do |klass| | ||
klass.template_root ||= "#{RAILS_ROOT}/app/views/" | ||
end | ||
|
||
|
||
# Include your app's configuration here: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,51 @@ | ||
RAILS_ROOT = File.expand_path(File.dirname(__FILE__) + "/../") | ||
RAILS_ENV = ENV['RAILS_ENV'] || 'development' | ||
|
||
ADDITIONAL_LOAD_PATHS = [ "app/models", "app/controllers", "app/helpers", "config", "lib", "vendor" ] | ||
ADDITIONAL_LOAD_PATHS.unshift(Dir["#{RAILS_ROOT}/app/models/[a-z]*"].collect{ |dir| "app/models/#{File.basename(dir)}" }) | ||
ADDITIONAL_LOAD_PATHS.unshift("test/mocks/#{RAILS_ENV}") | ||
|
||
ADDITIONAL_LOAD_PATHS.flatten.each { |dir| $:.unshift "#{RAILS_ROOT}/#{dir}" } | ||
# Mocks first. | ||
ADDITIONAL_LOAD_PATHS = ["#{RAILS_ROOT}/test/mocks/#{RAILS_ENV}"] | ||
|
||
require 'rubygems' | ||
# Then model subdirectories. | ||
ADDITIONAL_LOAD_PATHS.concat(Dir["#{RAILS_ROOT}/app/models/[a-z]*"]) | ||
|
||
# Followed by the standard includes. | ||
ADDITIONAL_LOAD_PATHS.concat %w( | ||
app/models | ||
app/controllers | ||
app/helpers | ||
config | ||
lib | ||
vendor | ||
).map { |dir| "#{RAILS_ROOT}/#{dir}" } | ||
|
||
# Prepend to $LOAD_PATH | ||
ADDITIONAL_LOAD_PATHS.reverse.each do |dir| | ||
$:.unshift(dir) if File.directory?(dir) | ||
end | ||
|
||
|
||
# Require Rails gems. | ||
require 'rubygems' | ||
require_gem 'activerecord' | ||
require_gem 'actionpack' | ||
require_gem 'actionmailer' | ||
require_gem 'rails' | ||
|
||
require 'yaml' | ||
|
||
ActionController::Base.template_root = ActionMailer::Base.template_root = "#{RAILS_ROOT}/app/views/" | ||
# Environment-specific configuration. | ||
require 'yaml' | ||
ActiveRecord::Base.configurations = YAML::load(File.open("#{RAILS_ROOT}/config/database.yml")) | ||
|
||
ActionController::Base.require_or_load 'abstract_application' | ||
ActionController::Base.require_or_load "environments/#{RAILS_ENV}" | ||
|
||
# Configure defaults if the included environment did not. | ||
RAILS_DEFAULT_LOGGER = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log") | ||
[ActiveRecord::Base, ActionController::Base, ActionMailer::Base].each do |klass| | ||
klass.logger ||= RAILS_DEFAULT_LOGGER | ||
end | ||
[ActionController::Base, ActionMailer::Base].each do |klass| | ||
klass.template_root ||= "#{RAILS_ROOT}/app/views/" | ||
end | ||
|
||
|
||
# Include your app's configuration here: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
ActiveRecord::Base.logger = ActionController::Base.logger = ActionMailer::Base.logger = Logger.new("#{RAILS_ROOT}/log/test.log") | ||
ActiveRecord::Base.establish_connection(:test) | ||
ActionController::Base.consider_all_requests_local = true | ||
ActionController::Base.reload_dependencies = false | ||
ActiveRecord::Base.reload_associations = false |