aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-09-26 10:56:36 -0500
committerJoshua Peek <josh@joshpeek.com>2009-09-26 10:56:36 -0500
commit5eeed9f00a3bd57134cfa0e6792cd8767619c132 (patch)
tree4bf900b647c5b5d1154aae79c333c615203b594c /railties
parentc83c0f693628baa644eb902ff70d719fe33e3787 (diff)
downloadrails-5eeed9f00a3bd57134cfa0e6792cd8767619c132.tar.gz
rails-5eeed9f00a3bd57134cfa0e6792cd8767619c132.tar.bz2
rails-5eeed9f00a3bd57134cfa0e6792cd8767619c132.zip
Move tmp directory creation from server to initializer
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/commands/server.rb4
-rw-r--r--railties/lib/rails/initializer.rb7
2 files changed, 7 insertions, 4 deletions
diff --git a/railties/lib/rails/commands/server.rb b/railties/lib/rails/commands/server.rb
index 25f5a8ada5..a600e1e9db 100644
--- a/railties/lib/rails/commands/server.rb
+++ b/railties/lib/rails/commands/server.rb
@@ -44,10 +44,6 @@ end
puts "=> Booting #{ActiveSupport::Inflector.demodulize(server)}"
puts "=> Rails #{Rails.version} application starting on http://#{options[:Host]}:#{options[:Port]}}"
-%w(cache pids sessions sockets).each do |dir_to_make|
- FileUtils.mkdir_p(File.join(RAILS_ROOT, 'tmp', dir_to_make))
-end
-
if options[:detach]
Process.daemon
pid = "#{RAILS_ROOT}/tmp/pids/server.pid"
diff --git a/railties/lib/rails/initializer.rb b/railties/lib/rails/initializer.rb
index 8a34411ce7..3065a8d111 100644
--- a/railties/lib/rails/initializer.rb
+++ b/railties/lib/rails/initializer.rb
@@ -195,6 +195,13 @@ module Rails
plugin_loader.add_plugin_load_paths
end
+ # Create tmp directories
+ Initializer.default.add :ensure_tmp_directories_exist do
+ %w(cache pids sessions sockets).each do |dir_to_make|
+ FileUtils.mkdir_p(File.join(configuration.root_path, 'tmp', dir_to_make))
+ end
+ end
+
# Loads the environment specified by Configuration#environment_path, which
# is typically one of development, test, or production.
Initializer.default.add :load_environment do