Froze rails gems
[depot.git] / vendor / rails / railties / lib / commands / servers / thin.rb
1 require 'rbconfig'
2 require 'commands/servers/base'
3 require 'thin'
4
5
6 options = ARGV.clone
7 options.insert(0,'start') unless Thin::Runner.commands.include?(options[0])
8
9 thin = Thin::Runner.new(options)
10
11 puts "=> Rails #{Rails.version} application starting on http://#{thin.options[:address]}:#{thin.options[:port]}"
12 puts "=> Ctrl-C to shutdown server"
13
14 log = Pathname.new("#{File.expand_path(RAILS_ROOT)}/log/#{RAILS_ENV}.log").cleanpath
15 open(log, (File::WRONLY | File::APPEND | File::CREAT)) unless File.exist? log
16 tail_thread = tail(log)
17 trap(:INT) { exit }
18
19 begin
20 thin.run!
21 ensure
22 tail_thread.kill if tail_thread
23 puts 'Exiting'
24 end
25