Sha256: 3c872798fb219848a770126d50914881c4801d2d783f879f205f5bc19b098d44

Contents?: true

Size: 757 Bytes

Versions: 2

Compression:

Stored size: 757 Bytes

Contents

require "pp"
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "twirl/server"

old_handler = trap(:INT) do
  puts "exiting"
  exit
  old_handler.call if old_handler.respond_to?(:call)
end

dir = File.expand_path("../../tmp/kestrel", __FILE__)
FileUtils.mkdir_p dir

server = Twirl::Server.new(dir)
p server

old_handler = trap(:INT) do
  server.stop
  old_handler.call if old_handler.respond_to?(:call)
end

server.stop if server.running?

server.start
puts "The server is running. ctrl + c to stop."

loop {
  p server.status
  sleep 5
  # forever
}

# another_dir = File.expand_path("../../tmp/another", __FILE__)
# FileUtils.mkdir_p another_dir
# another_server = Twirl::Server.new(another_dir)
# p another_server
# another_server.start

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
twirl-0.2.0 examples/server.rb
twirl-0.1.0 examples/server.rb