Singing with Sinatra 예제를 따라하는 중이다.

원래는 Ruby code를 변경할때마다 웹서버를 중단시키고 재실행해주어야 하는데,

shotgun을 이용하면 이런 과정 없이 브라우저에서 바로 수정 내용을 확인할 수 있다.


문제는 Mac에서는 shotgun이 잘 동작하는데,

Windows에서는 다음의 에러를 출력한다.

C:/Ruby193/lib/ruby/gems/1.9.1/gems/shotgun-0.9/bin/shotgun:99:in ``': No such file or directory - uname (Errno::ENOENT)

        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/shotgun-0.9/bin/shotgun:99:in `block in <top (required)>'

        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/shotgun-0.9/bin/shotgun:98:in `each'

        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/shotgun-0.9/bin/shotgun:98:in `find'

        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/shotgun-0.9/bin/shotgun:98:in `<top (required)>'

        from C:/Ruby193/bin/shotgun:23:in `load'

        from C:/Ruby193/bin/shotgun:23:in `<main>'


shotgun의 이러한 문제는 Sinatra::Contribute project에 포함되어 있는 Reloader로서 해결할 수 있었다.

다음과 같이 설치하고

gem install sinatra-contrib


다음처럼 사용하면 된다.

require "sinatra"
require "sinatra/reloader" if development?

# Your classic application code goes here...


'Ruby' 카테고리의 다른 글

YAML 사용하기  (0) 2014.03.07
Koan - Methods  (0) 2014.03.01
Koan - Regular Expressions  (0) 2014.02.28
Koans - Symbols  (0) 2014.02.27
Ruby에서의 TDD  (0) 2014.02.22

+ Recent posts