2004-12-18 00:47:30 +00:00
|
|
|
RAILS_ROOT = File.dirname(__FILE__) + "/../"
|
2004-11-24 01:04:44 +00:00
|
|
|
RAILS_ENV = ENV['RAILS_ENV'] || 'development'
|
|
|
|
|
|
|
|
|
2004-11-25 16:22:07 +00:00
|
|
|
# Mocks first.
|
|
|
|
ADDITIONAL_LOAD_PATHS = ["#{RAILS_ROOT}/test/mocks/#{RAILS_ENV}"]
|
|
|
|
|
|
|
|
# Then model subdirectories.
|
2004-11-30 17:19:01 +00:00
|
|
|
ADDITIONAL_LOAD_PATHS.concat(Dir["#{RAILS_ROOT}/app/models/[_a-z]*"])
|
2005-02-20 13:58:03 +00:00
|
|
|
ADDITIONAL_LOAD_PATHS.concat(Dir["#{RAILS_ROOT}/components/[_a-z]*"])
|
2004-11-25 16:22:07 +00:00
|
|
|
|
|
|
|
# Followed by the standard includes.
|
|
|
|
ADDITIONAL_LOAD_PATHS.concat %w(
|
2004-11-30 17:19:01 +00:00
|
|
|
app
|
2004-11-25 16:22:07 +00:00
|
|
|
app/models
|
|
|
|
app/controllers
|
|
|
|
app/helpers
|
2005-02-18 10:58:25 +00:00
|
|
|
app/apis
|
2004-11-25 16:22:07 +00:00
|
|
|
config
|
2005-02-20 13:58:03 +00:00
|
|
|
components
|
2004-11-25 16:22:07 +00:00
|
|
|
lib
|
|
|
|
vendor
|
|
|
|
vendor/railties
|
|
|
|
vendor/railties/lib
|
2005-02-15 15:57:44 +00:00
|
|
|
vendor/activesupport/lib
|
2004-11-25 16:22:07 +00:00
|
|
|
vendor/activerecord/lib
|
|
|
|
vendor/actionpack/lib
|
|
|
|
vendor/actionmailer/lib
|
2005-02-18 23:43:09 +00:00
|
|
|
vendor/actionwebservice/lib
|
2004-11-25 16:22:07 +00:00
|
|
|
).map { |dir| "#{RAILS_ROOT}/#{dir}" }
|
|
|
|
|
|
|
|
# Prepend to $LOAD_PATH
|
2004-11-30 17:19:01 +00:00
|
|
|
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) }
|
2004-11-25 16:22:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Require Rails libraries.
|
2005-02-15 16:15:02 +00:00
|
|
|
require 'active_support'
|
2004-11-24 01:04:44 +00:00
|
|
|
require 'active_record'
|
|
|
|
require 'action_controller'
|
|
|
|
require 'action_mailer'
|
2005-02-19 00:02:21 +00:00
|
|
|
require 'action_web_service'
|
2004-11-24 01:04:44 +00:00
|
|
|
|
|
|
|
|
2004-11-25 16:22:07 +00:00
|
|
|
# Environment-specific configuration.
|
2004-11-30 18:52:20 +00:00
|
|
|
require_dependency "environments/#{RAILS_ENV}"
|
2004-11-24 01:04:44 +00:00
|
|
|
ActiveRecord::Base.configurations = YAML::load(File.open("#{RAILS_ROOT}/config/database.yml"))
|
2004-11-25 22:34:24 +00:00
|
|
|
ActiveRecord::Base.establish_connection
|
|
|
|
|
2004-11-25 16:22:07 +00:00
|
|
|
|
|
|
|
# Configure defaults if the included environment did not.
|
2004-12-19 13:29:39 +00:00
|
|
|
begin
|
|
|
|
RAILS_DEFAULT_LOGGER = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log")
|
|
|
|
rescue StandardError
|
|
|
|
RAILS_DEFAULT_LOGGER = Logger.new(STDERR)
|
|
|
|
RAILS_DEFAULT_LOGGER.level = Logger::WARN
|
|
|
|
RAILS_DEFAULT_LOGGER.warn(
|
2005-01-15 17:28:01 +00:00
|
|
|
"Rails Error: Unable to access log file. Please ensure that log/#{RAILS_ENV}.log exists and is chmod 0666. " +
|
2004-12-19 13:29:39 +00:00
|
|
|
"The log level has been raised to WARN and the output directed to STDERR until the problem is fixed."
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2005-02-18 10:58:25 +00:00
|
|
|
[ActiveRecord, ActionController, ActionMailer].each { |mod| mod::Base.logger ||= RAILS_DEFAULT_LOGGER }
|
|
|
|
[ActionController, ActionMailer].each { |mod| mod::Base.template_root ||= "#{RAILS_ROOT}/app/views/" }
|
2005-02-17 23:03:48 +00:00
|
|
|
ActionController::Routing::Routes.reload
|
2004-11-30 17:19:01 +00:00
|
|
|
|
2005-02-20 13:58:03 +00:00
|
|
|
Controllers = Dependencies::LoadingModule.root(
|
2005-03-07 01:07:06 +00:00
|
|
|
File.join(RAILS_ROOT, 'app', 'controllers'),
|
|
|
|
File.join(RAILS_ROOT, 'components')
|
2005-02-20 13:58:03 +00:00
|
|
|
)
|
|
|
|
|
2004-11-25 16:22:07 +00:00
|
|
|
# Include your app's configuration here:
|