stop rails when shutting down
This commit is contained in:
parent
1d9f43326c
commit
39052564a9
@ -17,13 +17,26 @@ module Guard
|
|||||||
|
|
||||||
def run_all
|
def run_all
|
||||||
Notifier.notify("Rails restarting on port #{options[:port]} in #{options[:environment]}", :title => "Restarting Rails...", :image => :pending)
|
Notifier.notify("Rails restarting on port #{options[:port]} in #{options[:environment]}", :title => "Restarting Rails...", :image => :pending)
|
||||||
system %{sh -c '[[ -f tmp/pids/#{options[:environment]}.pid ]] && kill $(cat tmp/pids/#{options[:environment]}.pid)'}
|
stop_rails ; start_rails
|
||||||
system %{rails s -d -e #{options[:environment]} -p #{options[:port]}}
|
end
|
||||||
|
|
||||||
|
def stop
|
||||||
|
Notifier.notify("Until next time...", :title => "Rails shutting down.", :image => :pending)
|
||||||
|
stop_rails
|
||||||
end
|
end
|
||||||
|
|
||||||
def run_on_change(paths)
|
def run_on_change(paths)
|
||||||
run_all
|
run_all
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def start_rails
|
||||||
|
system %{rails s -d -e #{options[:environment]} -p #{options[:port]}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def stop_rails
|
||||||
|
system %{sh -c '[[ -f tmp/pids/#{options[:environment]}.pid ]] && kill $(cat tmp/pids/#{options[:environment]}.pid)'}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user