Class: Gumdrop::Server
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- Gumdrop::Server
- Includes:
- Util::Loggable
- Defined in:
- lib/gumdrop/server.rb
Instance Method Summary collapse
- #get_content_path(file_path, site) ⇒ Object
- #handle_proxy(params, env) ⇒ Object
- #static_asset(file_path) ⇒ Object
Methods included from Util::Loggable
Instance Method Details
#get_content_path(file_path, site) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/gumdrop/server.rb', line 78 def get_content_path(file_path, site) keys= [ file_path, "#{file_path}.html", "#{file_path}/index.html" ] if file_path == "" "index.html" else keys.detect {|k| site.contents.has_key?(k) } or file_path end end |
#handle_proxy(params, env) ⇒ Object
91 92 93 94 95 96 97 98 99 |
# File 'lib/gumdrop/server.rb', line 91 def handle_proxy(params, env) proxy_to= params[:splat][0] proxy_parts= proxy_to.split('/') host= proxy_parts.shift path_info= "/#{proxy_parts.join('/')}" #puts "HOST: #{host} PATH_INFO: #{path_info}" opts={ :to=>host, :path_info=>path_info } Gumdrop.handle_proxy opts, proxy_to, env end |
#static_asset(file_path) ⇒ Object
101 102 103 104 |
# File 'lib/gumdrop/server.rb', line 101 def static_asset(file_path) return false if file_path.nil? or File.extname(file_path).nil? STATIC_ASSETS.include? File.extname(file_path).to_s end |