diff --git a/railties/CHANGELOG b/railties/CHANGELOG index 4fda0feaad..ff1138f412 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Copy lighttpd.conf when it is first needed, instead of on app creation [Jamis Buck] + * Use require_library_or_gem 'fcgi' in script/server [Sam Stephenson] * Added default lighttpd config in config/lighttpd.conf and added a default runner for lighttpd in script/server (works like script/server, but using lighttpd and FastCGI). It will use lighttpd if available, otherwise WEBrick. You can force either or using 'script/server lighttpd' or 'script/server webrick' [DHH] diff --git a/railties/configs/lighttpd.conf b/railties/configs/lighttpd.conf index e169ee210c..3577360f7d 100644 --- a/railties/configs/lighttpd.conf +++ b/railties/configs/lighttpd.conf @@ -1,5 +1,5 @@ # Default configuration file for the lighttpd web server -# Start using ./script/lighttpd +# Start using ./script/server lighttpd server.port = 3000 diff --git a/railties/lib/commands/servers/lighttpd.rb b/railties/lib/commands/servers/lighttpd.rb index 488c7d61c4..0205e10c0a 100644 --- a/railties/lib/commands/servers/lighttpd.rb +++ b/railties/lib/commands/servers/lighttpd.rb @@ -21,6 +21,14 @@ end config_file = "#{RAILS_ROOT}/config/lighttpd.conf" +unless File.exist?(config_file) + require 'fileutils' + source = File.expand_path(File.join(File.dirname(__FILE__), + "..", "..", "..", "configs", "lighttpd.conf")) + puts "=> #{config_file} not found, copying from #{source}" + FileUtils.cp source, config_file +end + port = IO.read(config_file).scan(/^server.port\s*=\s*(\d+)/).first rescue 3000 puts "=> Rails application started on http://0.0.0.0:#{port}" 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 9292f227dc..01f371ce42 100644 --- a/railties/lib/rails_generator/generators/applications/app/app_generator.rb +++ b/railties/lib/rails_generator/generators/applications/app/app_generator.rb @@ -39,7 +39,6 @@ class AppGenerator < Rails::Generator::Base } m.template "configs/routes.rb", "config/routes.rb" m.template "configs/apache.conf", "public/.htaccess" - m.template "configs/lighttpd.conf", "config/lighttpd.conf" # Environments m.file "environments/boot.rb", "config/boot.rb"