more shell goodness
This commit is contained in:
parent
39052564a9
commit
877115a1cb
|
@ -30,12 +30,18 @@ module Guard
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
def pid_file
|
||||||
|
File.expand_path("tmp/pids/#{options[:environment]}.pid")
|
||||||
|
end
|
||||||
|
|
||||||
def start_rails
|
def start_rails
|
||||||
system %{rails s -d -e #{options[:environment]} -p #{options[:port]}}
|
system %{sh -c 'rails s -d -e #{options[:environment]} -p #{options[:port]} --pid #{pid_file}'}
|
||||||
end
|
end
|
||||||
|
|
||||||
def stop_rails
|
def stop_rails
|
||||||
system %{sh -c '[[ -f tmp/pids/#{options[:environment]}.pid ]] && kill $(cat tmp/pids/#{options[:environment]}.pid)'}
|
if File.file?(pid_file)
|
||||||
|
system %{kill -INT #{File.read(pid_file).strip}}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue