Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use guard with foreman?

Given the guard-rails gem is an easy way to start a rails server and to relaunch it automatically during development as the source files change;

how should this gem be used to launch the processes in a Procfile instead of having it run rails s?

I have already found the foreman gem, which can read and start each process listed in the Procfile with foreman start.

Thanks! -A

Edit 1

This is a bad approach. Each process should be managed individually by guard so that they can

  • be restarted independently, and
  • be launched with development-friendly flags
like image 632
Alec Wenzowski Avatar asked Nov 14 '22 18:11

Alec Wenzowski


1 Answers

you could fork the gem and add your changes to the RailsRunner that has a hardcoded command:

  %{sh -c 'cd #{Dir.pwd} && rails s #{rails_options.join(' ')} &'}

https://github.com/guard/guard-rails/blob/master/lib/guard/rails/runner.rb

like image 118
phoet Avatar answered Dec 20 '22 01:12

phoet