stop rails when shutting down
This commit is contained in:
parent
1d9f43326c
commit
39052564a9
@ -17,13 +17,26 @@ module Guard
|
||||
|
||||
def run_all
|
||||
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)'}
|
||||
system %{rails s -d -e #{options[:environment]} -p #{options[:port]}}
|
||||
stop_rails ; start_rails
|
||||
end
|
||||
|
||||
def stop
|
||||
Notifier.notify("Until next time...", :title => "Rails shutting down.", :image => :pending)
|
||||
stop_rails
|
||||
end
|
||||
|
||||
def run_on_change(paths)
|
||||
run_all
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user