lib/mojito/rendering/file.rb in mojito-0.1.1 vs lib/mojito/rendering/file.rb in mojito-0.1.2
- old
+ new
@@ -4,13 +4,14 @@
module File
require 'pathname'
require 'mime/types'
require 'time'
+ require 'where'
def file!(filename)
- path = Pathname === filename ? filename : Pathname.new(filename.to_s)
+ path = Where.cdir(1) + filename
restrict_path! path if respond_to? :restrict_path!
if path.readable? and path.file?
body = FileResponse.new path
halt! [response.status, response.headers.merge(body.compute_headers), body]
else
@@ -48,6 +49,8 @@
end
end
+ Mojito::PLUGINS[:file] = File
+
end
\ No newline at end of file