This repository was archived by the owner on Dec 25, 2020. It is now read-only.

Description
Hi Michael,
I'm trying to develop an application for which Wee seems very well suited.
One thing that slows down development quite a lot is that when I change the Ruby code of a component, the component does not get reloaded.
Rails and Ramaze both do this and its very useful!
To achieve this, you can reuse Ramaze's source reloader which is a Rack app:
require 'rack/handler/webrick'
require 'ramaze'
app = Rack::Builder.app do
use Ramaze::Reloader
Wee::JQuery.install('/jquery', self)
map '/' do
run Wee::Application.new {
Wee::Session.new(HelloWorld.new)
}
end
end
Rack::Handler::WEBrick.run(app, :Port => 2000)
This correctly reloads the changed files.
The only problem is that the server is not shut down before the reload and blocking the port.
You can redefine some methods in Ramaze::Reloader::Hooks in order to do this,
but I'm not proficient enough in Rack, WEBrick and Wee to do this.
Anyway, here is what I tried:
$server = nil
Rack::Handler::WEBrick.run(app, :Port => 2000) {|srvr| $server = srvr }
Ramaze::Reloader::Hooks.class_eval do
def before_cycle
$server.shutdown
end
end
It would be great if you could add the missing puzzle peaces.
Thanks a lot!
Martin