diff options
author | Bob Klosinski <fluxin@gmail.com> | 2008-06-25 16:40:00 -0500 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-06-25 18:56:52 -0700 |
commit | a93ea88c0623b4f65af98c0eb55924c335bb3ac1 (patch) | |
tree | dee675ee2f0adc7c1e09f53b988dbe609bdf10be /railties/lib/commands/servers | |
parent | 24c7f41b4fdc411e35131f9065852a685032211f (diff) | |
download | rails-a93ea88c0623b4f65af98c0eb55924c335bb3ac1.tar.gz rails-a93ea88c0623b4f65af98c0eb55924c335bb3ac1.tar.bz2 rails-a93ea88c0623b4f65af98c0eb55924c335bb3ac1.zip |
Added Thin support to script/server. [#488 state:resolved]
Diffstat (limited to 'railties/lib/commands/servers')
-rw-r--r-- | railties/lib/commands/servers/thin.rb | 25 |
1 files changed, 25 insertions, 0 deletions
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 + |