aboutsummaryrefslogtreecommitdiffstats
path: root/railties/environments
diff options
context:
space:
mode:
Diffstat (limited to 'railties/environments')
-rw-r--r--railties/environments/development.rb2
-rw-r--r--railties/environments/production.rb6
-rw-r--r--railties/environments/shared.rb35
-rw-r--r--railties/environments/shared_for_gem.rb23
-rw-r--r--railties/environments/test.rb2
5 files changed, 68 insertions, 0 deletions
diff --git a/railties/environments/development.rb b/railties/environments/development.rb
new file mode 100644
index 0000000000..81d5a73403
--- /dev/null
+++ b/railties/environments/development.rb
@@ -0,0 +1,2 @@
+ActiveRecord::Base.logger = ActionController::Base.logger = ActionMailer::Base.logger = Logger.new("#{RAILS_ROOT}/log/development.log")
+ActiveRecord::Base.establish_connection(:development) \ No newline at end of file
diff --git a/railties/environments/production.rb b/railties/environments/production.rb
new file mode 100644
index 0000000000..1ecda598de
--- /dev/null
+++ b/railties/environments/production.rb
@@ -0,0 +1,6 @@
+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 \ No newline at end of file
diff --git a/railties/environments/shared.rb b/railties/environments/shared.rb
new file mode 100644
index 0000000000..f5d4771db6
--- /dev/null
+++ b/railties/environments/shared.rb
@@ -0,0 +1,35 @@
+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}" }
+
+
+require 'active_record'
+require 'action_controller'
+require 'action_mailer'
+
+require 'yaml'
+
+ActionController::Base.template_root = ActionMailer::Base.template_root = "#{RAILS_ROOT}/app/views/"
+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}" \ No newline at end of file
diff --git a/railties/environments/shared_for_gem.rb b/railties/environments/shared_for_gem.rb
new file mode 100644
index 0000000000..1ae6746122
--- /dev/null
+++ b/railties/environments/shared_for_gem.rb
@@ -0,0 +1,23 @@
+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}" }
+
+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/"
+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}"
diff --git a/railties/environments/test.rb b/railties/environments/test.rb
new file mode 100644
index 0000000000..6ab6a1f50a
--- /dev/null
+++ b/railties/environments/test.rb
@@ -0,0 +1,2 @@
+ActiveRecord::Base.logger = ActionController::Base.logger = ActionMailer::Base.logger = Logger.new("#{RAILS_ROOT}/log/test.log")
+ActiveRecord::Base.establish_connection(:test)