4
require 'sinatra'
require 'rubygems'

class TestServer < Sinatra::Application
set :port, 22340
    get '/' do
        "Hello World"
    end
    run! if app_file == $0
end

Ruby 2.0.0-p0 と Sinatra 1.4.2 を使用した非常にシンプルなアプリケーション

ctrl-c を押すと、webrick サーバーがデフォルトのポートで再起動します...以下の出力を参照してください

LM-BOS-00715009:server joshughes$ ruby test.rb 
[2013-04-19 16:07:48] INFO  WEBrick 1.3.1
[2013-04-19 16:07:48] INFO  ruby 2.0.0 (2013-02-24) [x86_64-darwin11.4.2]
== Sinatra/1.4.2 has taken the stage on 22340 for development with backup from WEBrick
[2013-04-19 16:07:48] INFO  WEBrick::HTTPServer#start: pid=63798 port=22340
^C
== Sinatra has ended his set (crowd applauds)
[2013-04-19 16:07:56] INFO  going to shutdown ...
[2013-04-19 16:07:56] INFO  WEBrick::HTTPServer#start done.
[2013-04-19 16:07:56] INFO  WEBrick 1.3.1
[2013-04-19 16:07:56] INFO  ruby 2.0.0 (2013-02-24) [x86_64-darwin11.4.2]
== Sinatra/1.4.2 has taken the stage on 4567 for development with backup from WEBrick
[2013-04-19 16:07:56] INFO  WEBrick::HTTPServer#start: pid=63798 port=4567
^C

ここで何がうまくいかないのか、誰かが私を助けることができますか?

4

1 に答える 1