开发者

Automatically Refreshing Rails Metal In Development Mode

开发者 https://www.devze.com 2022-12-09 22:02 出处:网络
I am trying to develop a rails metal endpoint using sinatra, but is proving to be a pain because I have to restart the server ever开发者_运维百科y time I change the code. I am in Jruby and running fro

I am trying to develop a rails metal endpoint using sinatra, but is proving to be a pain because I have to restart the server ever开发者_运维百科y time I change the code. I am in Jruby and running from within a larger Java app. Is there an easy way to make this code refresh for every request?


Just because I like abstract abstraction, this is Ryan's code v2:

def every s
  loop do
    sleep s
    yield
  end
end

every 1 { `touch tmp/restart.txt` }


I don't think there is a way to automatically reload sinatra code, however:

If you were running passenger, you could try running in irb:

 loop do
   `touch tmp/restart.txt`
   sleep(1)
 end

Which will then tell the passenger instance to restart the application.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号