Skip to content

Commit

Permalink
Treat .erb files as ERB templates before serving
Browse files Browse the repository at this point in the history
  • Loading branch information
mconigliaro committed Jul 23, 2012
1 parent 1ac899d commit dd4606b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/veewee/provider/core/helper/web.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ def initialize(server,localfile,ui)
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
Expand Down

0 comments on commit dd4606b

Please sign in to comment.