Move tmp directory creation from server to initializer

This commit is contained in:
Joshua Peek
2009-09-26 10:56:36 -05:00
parent c83c0f6936
commit 5eeed9f00a
2 changed files with 7 additions and 4 deletions

View File

@@ -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"

View File

@@ -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