Bringing various things inline with the current state of Rails develolpment

This commit is contained in:
Alexey Verkhovsky 2005-03-25 19:11:41 +00:00
parent 0a63789e61
commit 8de7ca3cee
38 changed files with 204 additions and 5484 deletions

View file

@ -11,44 +11,53 @@ RAILS_ROOT = File.expand_path(File.dirname(__FILE__) + '/../') unless defined? R
RAILS_ENV = ENV['RAILS_ENV'] || 'production' unless defined? RAILS_ENV
unless defined? ADDITIONAL_LOAD_PATHS
# Mocks first.
# Mocks first.
ADDITIONAL_LOAD_PATHS = ["#{RAILS_ROOT}/test/mocks/#{RAILS_ENV}"]
# Then model subdirectories.
# Then model subdirectories.
ADDITIONAL_LOAD_PATHS.concat(Dir["#{RAILS_ROOT}/app/models/[_a-z]*"])
ADDITIONAL_LOAD_PATHS.concat(Dir["#{RAILS_ROOT}/components/[_a-z]*"])
# Followed by the standard includes.
# Followed by the standard includes.
ADDITIONAL_LOAD_PATHS.concat %w(
app
app/models
app/controllers
app/helpers
config
libraries
).map { |dir| "#{File.expand_path(File.join(RAILS_ROOT, dir))}" }
# Third party vendors
ADDITIONAL_LOAD_PATHS.concat %w(
vendor/bluecloth-1.0.0/lib
app
app/models
app/controllers
app/helpers
app/apis
components
config
lib
vendor
vendor/rails/railties
vendor/rails/railties/lib
vendor/rails/actionpack/lib
vendor/rails/activesupport/lib
vendor/rails/activerecord/lib
vendor/rails/actionmailer/lib
vendor/rails/actionwebservice/lib
vendor/madeleine-0.7.1/lib
vendor/RedCloth-3.0.3/lib
vendor/rubyzip-0.5.6
vendor/actionpack/lib
vendor/activesupport/lib
vendor/railties/lib
).map { |dir|
"#{File.expand_path(File.join(RAILS_ROOT, dir))}"
).map { |dir| "#{File.expand_path(File.join(RAILS_ROOT, dir))}"
}.delete_if { |dir| not File.exist?(dir) }
# Prepend to $LOAD_PATH
# Prepend to $LOAD_PATH
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) }
end
# Require Rails libraries.
require 'rubygems' unless File.directory?("#{RAILS_ROOT}/vendor/rails")
require 'active_support'
require 'action_controller'
require 'active_record_stub'
require 'instiki_errors'
require 'routes'
# Environment specific configuration
require_dependency "environments/#{RAILS_ENV}"
# Configure defaults if the included environment did not.
unless defined? RAILS_DEFAULT_LOGGER
RAILS_DEFAULT_LOGGER = Logger.new(STDERR)
ActionController::Base.logger ||= RAILS_DEFAULT_LOGGER
@ -61,15 +70,12 @@ unless defined? RAILS_DEFAULT_LOGGER
end
end
# Environment-specific configuration.
require "environments/#{RAILS_ENV}"
require 'wiki_service'
Socket.do_not_reverse_lookup = true
ActionController::Base.template_root ||= "#{RAILS_ROOT}/app/views/"
ActionController::Routing::Routes.reload
Controllers = Dependencies::LoadingModule.root(
File.expand_path(File.join(RAILS_ROOT, 'app', 'controllers')),
File.expand_path(File.join(RAILS_ROOT, 'components'))
File.join(RAILS_ROOT, 'app', 'controllers'),
File.join(RAILS_ROOT, 'components')
)
require 'wiki_service'
Socket.do_not_reverse_lookup = true