aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--railties/CHANGELOG8
-rw-r--r--railties/Rakefile6
-rw-r--r--railties/configs/lighttpd.conf2
-rw-r--r--railties/environments/environment.rb4
-rw-r--r--railties/lib/initializer.rb15
-rw-r--r--railties/lib/rails_generator/commands.rb5
-rw-r--r--railties/lib/rails_generator/generators/applications/app/app_generator.rb3
-rw-r--r--railties/lib/rails_generator/generators/components/model/model_generator.rb2
8 files changed, 35 insertions, 10 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index e63f68f355..8bb9133e55 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,13 @@
*SVN*
+* Changed the default configuration for lighttpd to use tmp/sockets instead of log/ for the FastCGI sockets [DHH]
+
+* Added a default configuration of the FileStore for fragment caching if tmp/cache is available, which makes action/fragment caching ready to use out of the box with no additional configuration [DHH]
+
+* Changed the default session configuration to place sessions in tmp/sessions, if that directory is available, instead of /tmp (this essentially means a goodbye to 9/10 White Screen of Death errors and should have web hosting firms around the world cheering) [DHH]
+
+* Added tmp/sessions, tmp/cache, and tmp/sockets as default directories in the Rails skeleton [DHH]
+
* Added that script/generate model will now automatically create a migration file for the model created. This can be turned off by calling the generator with --skip-migration [DHH]
* Added -d/--database option to the rails command, so you can do "rails --database=sqlite2 myapp" to start a new application preconfigured to use SQLite2 as the database. Removed the configuration examples from SQLite and PostgreSQL from the default MySQL configuration [DHH]
diff --git a/railties/Rakefile b/railties/Rakefile
index 49684cfca3..21cdd375c4 100644
--- a/railties/Rakefile
+++ b/railties/Rakefile
@@ -28,7 +28,11 @@ RUBY_FORGE_USER = "webster132"
# end
-BASE_DIRS = %w( app config/environments components db doc log lib lib/tasks public script script/performance script/process test vendor vendor/plugins )
+BASE_DIRS = %w(
+ app config/environments components db doc log lib lib/tasks public script script/performance script/process test vendor vendor/plugins
+ tmp/sessions tmp/cache tmp/sockets
+)
+
APP_DIRS = %w( models controllers helpers views views/layouts )
PUBLIC_DIRS = %w( images javascripts stylesheets )
TEST_DIRS = %w( fixtures unit functional mocks mocks/development mocks/test )
diff --git a/railties/configs/lighttpd.conf b/railties/configs/lighttpd.conf
index aa8607064c..6d421c8de0 100644
--- a/railties/configs/lighttpd.conf
+++ b/railties/configs/lighttpd.conf
@@ -19,7 +19,7 @@ fastcgi.server = ( ".fcgi" =>
(
"min-procs" => 1,
"max-procs" => 1,
- "socket" => CWD + "/log/fcgi.socket",
+ "socket" => CWD + "/tmp/sockets/fcgi.socket",
"bin-path" => CWD + "/public/dispatch.fcgi",
"bin-environment" => ( "RAILS_ENV" => "development" )
)
diff --git a/railties/environments/environment.rb b/railties/environments/environment.rb
index 0d5e79d1f9..7e3f3d26a7 100644
--- a/railties/environments/environment.rb
+++ b/railties/environments/environment.rb
@@ -20,10 +20,6 @@ Rails::Initializer.run do |config|
# (by default production uses :info, the others :debug)
# config.log_level = :debug
- # Enable page/fragment caching by setting a file-based store
- # (remember to create the caching directory and make it readable to the application)
- # config.action_controller.fragment_cache_store = :file_store, "#{RAILS_ROOT}/cache"
-
# Use the database for sessions instead of the file system
# (create the session table with 'rake create_sessions_table')
# config.action_controller.session_store = :active_record_store
diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb
index 9550d6d583..ea54e568cd 100644
--- a/railties/lib/initializer.rb
+++ b/railties/lib/initializer.rb
@@ -87,7 +87,8 @@ module Rails
initialize_dependency_mechanism
initialize_breakpoints
initialize_whiny_nils
-
+ initialize_temporary_directories
+
initialize_framework_settings
# Support for legacy configuration style where the environment
@@ -248,6 +249,18 @@ module Rails
require('active_support/whiny_nil') if configuration.whiny_nils
end
+ def initialize_temporary_directories
+ if configuration.frameworks.include?(:action_controller)
+ session_path = "#{RAILS_ROOT}/tmp/sessions/"
+ ActionController::Base.session_options[:tmpdir] = File.exist?(session_path) ? session_path : Dir::tmpdir
+
+ cache_path = "#{RAILS_ROOT}/tmp/cache/"
+ if File.exist?(cache_path)
+ ActionController::Base.fragment_cache_store = :file_store, cache_path
+ end
+ end
+ end
+
# Initializes framework-specific settings for each of the loaded frameworks
# (Configuration#frameworks). The available settings map to the accessors
# on each of the corresponding Base classes.
diff --git a/railties/lib/rails_generator/commands.rb b/railties/lib/rails_generator/commands.rb
index de6fefe093..dd72436fc8 100644
--- a/railties/lib/rails_generator/commands.rb
+++ b/railties/lib/rails_generator/commands.rb
@@ -309,8 +309,9 @@ module Rails
# When creating a migration, it knows to find the first available file in db/migrate and use the migration.rb template.
def migration_template(relative_source, relative_destination, template_options = {})
migration_directory relative_destination
- raise "Another migration is already named #{file_name}: #{existing_migrations(file_name).first}" if migration_exists?(file_name)
- template(relative_source, "#{relative_destination}/#{next_migration_string}_#{file_name}.rb", template_options)
+ migration_file_name = template_options[:migration_file_name] || file_name
+ raise "Another migration is already named #{migration_file_name}: #{existing_migrations(migration_file_name).first}" if migration_exists?(migration_file_name)
+ template(relative_source, "#{relative_destination}/#{next_migration_string}_#{migration_file_name}.rb", template_options)
end
private
diff --git a/railties/lib/rails_generator/generators/applications/app/app_generator.rb b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
index a192c14e0d..b421c5df74 100644
--- a/railties/lib/rails_generator/generators/applications/app/app_generator.rb
+++ b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
@@ -129,6 +129,9 @@ class AppGenerator < Rails::Generator::Base
test/unit
vendor
vendor/plugins
+ tmp/sessions
+ tmp/sockets
+ tmp/cache
)
MYSQL_SOCKET_LOCATIONS = [
diff --git a/railties/lib/rails_generator/generators/components/model/model_generator.rb b/railties/lib/rails_generator/generators/components/model/model_generator.rb
index 5e9aa882f3..9cadf863fb 100644
--- a/railties/lib/rails_generator/generators/components/model/model_generator.rb
+++ b/railties/lib/rails_generator/generators/components/model/model_generator.rb
@@ -19,7 +19,7 @@ class ModelGenerator < Rails::Generator::NamedBase
unless options[:skip_migration]
m.migration_template 'migration.rb', 'db/migrate', :assigns => {
:migration_name => "Add#{class_name.pluralize}"
- }
+ }, :migration_file_name => "add_#{file_name.pluralize}"
end
end
end