Class: Gumdrop::Server

Inherits:
Sinatra::Base
  • Object
show all
Includes:
Util::Loggable
Defined in:
lib/gumdrop/server.rb

Instance Method Summary collapse

Methods included from Util::Loggable

#log

Instance Method Details

#get_content_path(file_path, site) ⇒ Object



92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/gumdrop/server.rb', line 92

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



105
106
107
108
109
110
111
112
113
# File 'lib/gumdrop/server.rb', line 105

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



115
116
117
118
# File 'lib/gumdrop/server.rb', line 115

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