ace/project_generator/content/config.ru
Jakub Stastny aka botanicus a1596e5642 Added generator, ace-gen works!
2011-06-12 20:46:39 +02:00

32 lines
717 B
Ruby
Executable file

#!/usr/bin/env rackup
# This is just for development. The only thing it does
# is serving of static files from the output/ directory.
use Rack::Head
class Server
def initialize(root)
@file_server = Rack::File.new(root)
end
def call(env)
path = env["PATH_INFO"]
returned = @file_server.call(env)
if returned[0] == 404 && env["PATH_INFO"].end_with?("/")
env["PATH_INFO"] = File.join(env["PATH_INFO"], "index.html")
returned = @file_server.call(env)
log "[404]", env["PATH_INFO"] if returned[0] == 404
returned
else
returned
end
end
private
def log(bold, message)
warn "~ \033[1;31m#{bold}\033[0m #{message}"
end
end
run Server.new("output")