Search code examples
rubysinatrareload

How to make Puma reload everytime there are changes on .rb?


I use thin before for my sinatra app, and using rerun to automatically reload server when there are changes on .rb

rerun --pattern="**/*.{rb}" ruby ./main_service.rb

how to make puma do the same? since this command does not work:

rerun --pattern="**/*.{rb}" puma -b tcp://127.0.0.1:12345

that shows:

ERROR: No application configured, nothing to run

my config.ru:

require './main_service'
run Sinatra::Application

but when i use manual command puma -b tcp://127.0.0.1:12345 it works normally..


Solution

  • Hh nevermind, I found the solution:

    rerun --pattern="**/*.{rb}" "bundle exec puma -b tcp://127.0.0.1:12345 ./config.ru"
    

    the second rerun parameter must be quoted