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

참고문헌 : http://www.joinc.co.kr/modules/moniwiki/wiki.php/Site/C/Documents/minzkn_make#s-7


makefile에서 target이 있는 경우에는 해당 명령이 실행되지 않는다. 이 부분이 문제가 일으킬 수 있는데, 예를 들어 make clean 을 실행할때 실제로 clean이라는 파일이 존재하는 경우이다. 이 때문에 clean이라는 파일의 유무에 상관없이 make clean이 항상 실행되도록 할 필요가 있으며, 명시적으로 .PHONY: 를 통해 해당 target은 존재유무에 상관없이 항상 만들도록 한다.

즉, 해당 target은 실제 파일이 아님을 명시적으로 알려주는 것이다.

/* filename : hello.c */

#include 

int main(void)
{
    printf("Hello, world!\n");
  
    return 0;
}
#filename : makefile
.PHONY: clean

all: hello
    gcc hello.c -o hello

clean:
    rm hello



'Linux' 카테고리의 다른 글

tmux 3.2 설치 및 설정파일  (0) 2022.01.06
tmux 사용법  (0) 2014.03.13

섭씨 30도 at thirty degrees centigrade

환자의 체온은 섭씨 36.6도이다. The temperature of the patient is 36.6 degrees centigrade. 

+ Recent posts