mirror of
https://github.com/github/rails.git
synced 2026-01-27 23:38:11 -05:00
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]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2912 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
*SVN*
|
||||
|
||||
* 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]
|
||||
|
||||
* New configuration option config.plugin_paths which may be a single path like the default 'vendor/plugins' or an array of paths: ['vendor/plugins', 'lib/plugins']. [Jeremy Kemper]
|
||||
|
||||
* Plugins are discovered in nested paths, so you can organize your plugins directory as you like. [Jeremy Kemper]
|
||||
@@ -10,15 +12,13 @@
|
||||
|
||||
* Enable HTTP installation of plugins when svn isn't avaialable. Closes #2661. [Chad Fowler]
|
||||
|
||||
* Load Rails::Info after initialization [Sam Stephenson]
|
||||
|
||||
* Added script/about to display formatted Rails::Info output [Sam Stephenson]
|
||||
|
||||
* Added Rails::Info to catalog assorted information about a Rails application's environment [Sam Stephenson]
|
||||
|
||||
* Tail the logfile when running script/lighttpd in the foreground [Sam Stephenson]
|
||||
* Tail the logfile when running script/server lighttpd in the foreground [Sam Stephenson]
|
||||
|
||||
* Try to guess the port number from config/lighttpd.conf in script/lighttpd [Sam Stephenson]
|
||||
* Try to guess the port number from config/lighttpd.conf in script/server lighttpd [Sam Stephenson]
|
||||
|
||||
* Don't reap spawn-fcgi. #2727 [matthew@walker.wattle.id.au]
|
||||
|
||||
@@ -62,8 +62,6 @@
|
||||
|
||||
* Added test_plugins task: Run the plugin tests in vendor/plugins/**/test (or specify with PLUGIN=name) [DHH]
|
||||
|
||||
* Added default lighttpd config in config/lighttpd.conf and added a default runner for lighttpd in script/lighttpd (works like script/server, but using lighttpd and FastCGI) [DHH]
|
||||
|
||||
* Added plugin generator to create a stub structure for a new plugin in vendor/plugins (see "script/generate plugin" for help) [DHH]
|
||||
|
||||
* Fixed scaffold generator when started with only 1 parameter #2609 [self@mattmower.com]
|
||||
|
||||
@@ -37,7 +37,7 @@ LOG_FILES = %w( server.log development.log test.log production.log )
|
||||
HTML_FILES = %w( 404.html 500.html index.html robots.txt favicon.ico
|
||||
javascripts/prototype.js
|
||||
javascripts/effects.js javascripts/dragdrop.js javascripts/controls.js )
|
||||
BIN_FILES = %w( about breakpointer console destroy generate performance/benchmarker performance/profiler process/reaper process/spawner process/spinner runner server lighttpd plugin )
|
||||
BIN_FILES = %w( about breakpointer console destroy generate performance/benchmarker performance/profiler process/reaper process/spawner process/spinner runner server plugin )
|
||||
|
||||
VENDOR_LIBS = %w( actionpack activerecord actionmailer activesupport actionwebservice railties )
|
||||
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
require 'active_support'
|
||||
|
||||
unless RUBY_PLATFORM !~ /mswin/ && !silence_stderr { `lighttpd -version` }.blank?
|
||||
puts "lighttpd is not available on your system (or not in your path)"
|
||||
exit 1
|
||||
end
|
||||
|
||||
def tail_f(input)
|
||||
loop do
|
||||
line = input.gets
|
||||
yield line if line
|
||||
if input.eof?
|
||||
sleep 1
|
||||
input.seek(input.tell)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
config_file = "#{RAILS_ROOT}/config/lighttpd.conf"
|
||||
|
||||
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}"
|
||||
|
||||
if ARGV.first == "-d"
|
||||
puts "=> Configure in config/lighttpd.conf"
|
||||
detach = true
|
||||
else
|
||||
puts "=> Call with -d to detach (requires absolute paths in config/lighttpd.conf)"
|
||||
puts "=> Ctrl-C to shutdown server (see config/lighttpd.conf for options)"
|
||||
detach = false
|
||||
|
||||
Process.detach(fork do
|
||||
begin
|
||||
File.open("#{RAILS_ROOT}/log/#{RAILS_ENV}.log", 'r') do |log|
|
||||
log.seek(0, IO::SEEK_END)
|
||||
tail_f(log) {|line| puts line}
|
||||
end
|
||||
rescue Exception
|
||||
end
|
||||
exit
|
||||
end)
|
||||
end
|
||||
|
||||
trap(:INT) {exit}
|
||||
`lighttpd #{!detach ? "-D " : ""}-f #{config_file}`
|
||||
@@ -1,59 +1,22 @@
|
||||
require 'webrick'
|
||||
require 'optparse'
|
||||
require 'active_support'
|
||||
|
||||
OPTIONS = {
|
||||
:port => 3000,
|
||||
:ip => "0.0.0.0",
|
||||
:environment => (ENV['RAILS_ENV'] || "development").dup,
|
||||
:server_root => File.expand_path(RAILS_ROOT + "/public/"),
|
||||
:server_type => WEBrick::SimpleServer,
|
||||
:charset => "UTF-8",
|
||||
:mime_types => WEBrick::HTTPUtils::DefaultMimeTypes
|
||||
}
|
||||
|
||||
ARGV.options do |opts|
|
||||
script_name = File.basename($0)
|
||||
opts.banner = "Usage: ruby #{script_name} [options]"
|
||||
|
||||
opts.separator ""
|
||||
|
||||
opts.on("-p", "--port=port", Integer,
|
||||
"Runs Rails on the specified port.",
|
||||
"Default: 3000") { |OPTIONS[:port]| }
|
||||
opts.on("-b", "--binding=ip", String,
|
||||
"Binds Rails to the specified ip.",
|
||||
"Default: 0.0.0.0") { |OPTIONS[:ip]| }
|
||||
opts.on("-e", "--environment=name", String,
|
||||
"Specifies the environment to run this server under (test/development/production).",
|
||||
"Default: development") { |OPTIONS[:environment]| }
|
||||
opts.on("-m", "--mime-types=filename", String,
|
||||
"Specifies an Apache style mime.types configuration file to be used for mime types",
|
||||
"Default: none") { |mime_types_file| OPTIONS[:mime_types] = WEBrick::HTTPUtils::load_mime_types(mime_types_file) }
|
||||
|
||||
opts.on("-d", "--daemon",
|
||||
"Make Rails run as a Daemon (only works if fork is available -- meaning on *nix)."
|
||||
) { OPTIONS[:server_type] = WEBrick::Daemon }
|
||||
|
||||
opts.on("-c", "--charset=charset", String,
|
||||
"Set default charset for output.",
|
||||
"Default: UTF-8") { |OPTIONS[:charset]| }
|
||||
|
||||
opts.separator ""
|
||||
|
||||
opts.on("-h", "--help",
|
||||
"Show this help message.") { puts opts; exit }
|
||||
|
||||
opts.parse!
|
||||
server = case ARGV.first
|
||||
when "lighttpd"
|
||||
ARGV.shift
|
||||
when "webrick"
|
||||
ARGV.shift
|
||||
else
|
||||
if RUBY_PLATFORM !~ /mswin/ && !silence_stderr { `lighttpd -version` }.blank?
|
||||
"lighttpd"
|
||||
else
|
||||
"webrick"
|
||||
end
|
||||
end
|
||||
|
||||
ENV["RAILS_ENV"] = OPTIONS[:environment]
|
||||
RAILS_ENV.replace(OPTIONS[:environment]) if defined?(RAILS_ENV)
|
||||
if server == "webrick"
|
||||
puts "=> Booting WEBrick..."
|
||||
else
|
||||
puts "=> Booting lighttpd (use 'script/server webrick' to force WEBrick)"
|
||||
end
|
||||
|
||||
require RAILS_ROOT + "/config/environment"
|
||||
require 'webrick_server'
|
||||
|
||||
OPTIONS['working_directory'] = File.expand_path(RAILS_ROOT)
|
||||
|
||||
puts "=> Rails application started on http://#{OPTIONS[:ip]}:#{OPTIONS[:port]}"
|
||||
puts "=> Ctrl-C to shutdown server; call with --help for options" if OPTIONS[:server_type] == WEBrick::SimpleServer
|
||||
DispatchServlet.dispatch(OPTIONS)
|
||||
require "commands/servers/#{server}"
|
||||
@@ -49,7 +49,7 @@ class AppGenerator < Rails::Generator::Base
|
||||
m.file "environments/test.rb", "config/environments/test.rb"
|
||||
|
||||
# Scripts
|
||||
%w( about breakpointer console destroy generate performance/benchmarker performance/profiler process/reaper process/spawner process/spinner runner server lighttpd plugin ).each do |file|
|
||||
%w( about breakpointer console destroy generate performance/benchmarker performance/profiler process/reaper process/spawner process/spinner runner server plugin ).each do |file|
|
||||
m.file "bin/#{file}", "script/#{file}", script_options
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user