Skip to content

Instantly share code, notes, and snippets.

@bryanp
Created February 11, 2017 00:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryanp/f86f33081ec86c9eecf199e1d6340353 to your computer and use it in GitHub Desktop.
Save bryanp/f86f33081ec86c9eecf199e1d6340353 to your computer and use it in GitHub Desktop.
Pakyow 1.0 Process Reloading
require "bundler/setup"
require "pakyow"
require "rack/handler/puma"
def run
if Process.respond_to?(:fork)
@pid = Process.fork do
require "./app/setup"
Pakyow::App.run(ENV['RACK_ENV'])
end
else
puts "sorry :("
end
end
run
require "listen"
listener = Listen.to(".") do |modified, added, removed|
Process.kill("INT", @pid)
run
end.start
sleep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment