2004-11-23 20:04:44 -05:00
|
|
|
RAILS_ROOT = File.expand_path(File.dirname(__FILE__) + "/../")
|
|
|
|
RAILS_ENV = ENV['RAILS_ENV'] || 'development'
|
|
|
|
|
|
|
|
|
2004-11-25 11:22:07 -05:00
|
|
|
# Mocks first.
|
|
|
|
ADDITIONAL_LOAD_PATHS = ["#{RAILS_ROOT}/test/mocks/#{RAILS_ENV}"]
|
2004-11-23 20:04:44 -05:00
|
|
|
|
2004-11-25 11:22:07 -05:00
|
|
|
# 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
|
2004-11-23 20:04:44 -05:00
|
|
|
|
2004-11-25 11:22:07 -05:00
|
|
|
|
|
|
|
# Require Rails gems.
|
|
|
|
require 'rubygems'
|
2004-11-23 20:04:44 -05:00
|
|
|
require_gem 'activerecord'
|
|
|
|
require_gem 'actionpack'
|
|
|
|
require_gem 'actionmailer'
|
|
|
|
require_gem 'rails'
|
|
|
|
|
|
|
|
|
2004-11-25 11:22:07 -05:00
|
|
|
# Environment-specific configuration.
|
2004-11-23 20:04:44 -05:00
|
|
|
ActiveRecord::Base.configurations = YAML::load(File.open("#{RAILS_ROOT}/config/database.yml"))
|
2004-11-25 17:34:24 -05:00
|
|
|
ActiveRecord::Base.establish_connection
|
|
|
|
|
2004-11-23 20:04:44 -05:00
|
|
|
ActionController::Base.require_or_load 'abstract_application'
|
|
|
|
ActionController::Base.require_or_load "environments/#{RAILS_ENV}"
|
2004-11-25 11:22:07 -05:00
|
|
|
|
|
|
|
# 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:
|