Sha256: 8af053fd0e11e31e637a65ac89e4891ed2779d7de2c021ab11feead605b919b8
Contents?: true
Size: 695 Bytes
Versions: 4
Compression:
Stored size: 695 Bytes
Contents
class Rack::Statik def initialize(app, options={}) @app = app frank_root = File.expand_path(File.dirname(__FILE__)) + '/templates' root = options[:root] || Dir.pwd @frank_server = Rack::File.new(frank_root) @static_server = Rack::File.new(root) end # handles serving from __frank__ # looks for static access, if not found, # passes request to frank def call(env) path = env['PATH_INFO'] if path.include? '__frank__' env['PATH_INFO'].gsub!('/__frank__', '') result = @frank_server.call(env) elsif path.index('/') == 0 result = @static_server.call(env) end return result if result[0] == 200 @app.call(env) end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
frank-0.1.3 | lib/frank/statik.rb |
frank-0.1.2 | lib/frank/statik.rb |
frank-0.1.1 | lib/frank/statik.rb |
frank-0.1.0 | lib/frank/statik.rb |