diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-07-04 00:33:56 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-07-04 00:33:56 +0100 |
commit | 0a7923ea7a76c1136bddfe638a600c62457df751 (patch) | |
tree | 2709c19133af9342958fc51b36ad53ca56c2927a /railties/lib/commands | |
parent | 5dba6c024289e42c31894b7d13c1695049fcf30d (diff) | |
parent | 1a478923dc909bf7b6aea4f2ad49cbeee6dea259 (diff) | |
download | rails-0a7923ea7a76c1136bddfe638a600c62457df751.tar.gz rails-0a7923ea7a76c1136bddfe638a600c62457df751.tar.bz2 rails-0a7923ea7a76c1136bddfe638a600c62457df751.zip |
Merge commit 'mainstream/master'
Diffstat (limited to 'railties/lib/commands')
-rw-r--r-- | railties/lib/commands/plugin.rb | 2 | ||||
-rw-r--r-- | railties/lib/commands/server.rb | 14 | ||||
-rw-r--r-- | railties/lib/commands/servers/thin.rb | 25 |
3 files changed, 38 insertions, 3 deletions
diff --git a/railties/lib/commands/plugin.rb b/railties/lib/commands/plugin.rb index 105819ce90..ce4b0d051d 100644 --- a/railties/lib/commands/plugin.rb +++ b/railties/lib/commands/plugin.rb @@ -632,7 +632,7 @@ module Commands def options OptionParser.new do |o| o.set_summary_indent(' ') - o.banner = "Usage: #{@base_command.script_name} source URI [URI [URI]...]" + o.banner = "Usage: #{@base_command.script_name} unsource URI [URI [URI]...]" o.define_head "Remove repositories from the default search list." o.separator "" o.on_tail("-h", "--help", "Show this help message.") { puts o; exit } diff --git a/railties/lib/commands/server.rb b/railties/lib/commands/server.rb index 40ffdd1167..7306c248fb 100644 --- a/railties/lib/commands/server.rb +++ b/railties/lib/commands/server.rb @@ -13,11 +13,19 @@ rescue Exception # Mongrel not available end +begin + require_library_or_gem 'thin' +rescue Exception + # Thin not available +end + server = case ARGV.first - when "lighttpd", "mongrel", "new_mongrel", "webrick" + when "lighttpd", "mongrel", "new_mongrel", "webrick", "thin" ARGV.shift else - if defined?(Mongrel) + if defined?(Thin) + "thin" + elsif defined?(Mongrel) "mongrel" elsif RUBY_PLATFORM !~ /(:?mswin|mingw)/ && !silence_stderr { `lighttpd -version` }.blank? && defined?(FCGI) "lighttpd" @@ -33,6 +41,8 @@ case server puts "=> Booting lighttpd (use 'script/server webrick' to force WEBrick)" when "mongrel", "new_mongrel" puts "=> Booting Mongrel (use 'script/server webrick' to force WEBrick)" + when "thin" + puts "=> Booting Thin (use 'script/server webrick' to force WEBrick)" end %w(cache pids sessions sockets).each { |dir_to_make| FileUtils.mkdir_p(File.join(RAILS_ROOT, 'tmp', dir_to_make)) } diff --git a/railties/lib/commands/servers/thin.rb b/railties/lib/commands/servers/thin.rb new file mode 100644 index 0000000000..833469cab1 --- /dev/null +++ b/railties/lib/commands/servers/thin.rb @@ -0,0 +1,25 @@ +require 'rbconfig' +require 'commands/servers/base' +require 'thin' + + +options = ARGV.clone +options.insert(0,'start') unless Thin::Runner.commands.include?(options[0]) + +thin = Thin::Runner.new(options) + +puts "=> Rails #{Rails.version} application starting on http://#{thin.options[:address]}:#{thin.options[:port]}" +puts "=> Ctrl-C to shutdown server" + +log = Pathname.new("#{File.expand_path(RAILS_ROOT)}/log/#{RAILS_ENV}.log").cleanpath +open(log, (File::WRONLY | File::APPEND | File::CREAT)) unless File.exist? log +tail_thread = tail(log) +trap(:INT) { exit } + +begin + thin.run! +ensure + tail_thread.kill if tail_thread + puts 'Exiting' +end + |