lib/veewee/provider/core/helper/web.rb in veewee-0.3.0.alpha9 vs lib/veewee/provider/core/helper/web.rb in veewee-0.3.0.beta1

- old
+ new

@@ -19,13 +19,18 @@ end def do_GET(request,response) response['Content-Type']='text/plain' response.status = 200 - ui.info "Serving file #{@localfile}" - displayfile=File.open(@localfile,'r') - content=displayfile.read() - response.body=content + content = File.open(@localfile, "r").read + response.body = case File.extname(@localfile) + when ".erb" + ui.info "Rendering and serving file #{@localfile}" + ERB.new(content).result(binding) + else + ui.info "Serving file #{@localfile}" + content + end #If we shut too fast it might not get the complete file sleep 2 @server.shutdown end end