Skip to content

Commit

Permalink
Merge pull request #343 from livingsocial/erb
Browse files Browse the repository at this point in the history
Treat .erb files as ERB templates before serving
  • Loading branch information
jedi4ever committed Aug 3, 2012
2 parents 7418e45 + dd4606b commit 4672665
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 4672665

Please sign in to comment.