Module: Sake::Server
Overview
:nodoc:all
Defined Under Namespace
Classes: Handler
Instance Method Summary collapse
Instance Method Details
#start(args) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/server.rb', line 8 def start(args) if index = args.index('-p') port = args[index+1].to_i else port = 4567 end daemoned = args.include? '-d' config = Mongrel::Configurator.new :host => "127.0.0.1" do daemonize(:cwd => '.', :log_file => 'sake.log') if daemoned listener(:port => port) { uri "/", :handler => Handler.new } end trap("INT") { config.stop } config.run puts "# Serving warm sake tasks on port #{port}..." unless daemoned config.join end |