aboutsummaryrefslogtreecommitdiff
path: root/config.ru
diff options
context:
space:
mode:
authorBrandon Mathis <brandon@imathis.com>2011-06-24 17:17:35 -0400
committerBrandon Mathis <brandon@imathis.com>2011-06-24 17:17:35 -0400
commitef3ff431e5c3028b764d1938bb552a76c340799c (patch)
treeb6d606ab522422238063f41e3334b3d7492fe69d /config.ru
parenta128d4990b6a346076bb07892ecdab868fdce467 (diff)
downloadmy_new_personal_website-ef3ff431e5c3028b764d1938bb552a76c340799c.tar.xz
my_new_personal_website-ef3ff431e5c3028b764d1938bb552a76c340799c.zip
1. Added html5 video with flash fallback.
2. Added Rack support 3. Disqus support 4. Improved Readme 5. Improved Syntax flexibility and styling 6. Improved blockquote styling
Diffstat (limited to 'config.ru')
-rw-r--r--config.ru35
1 files changed, 35 insertions, 0 deletions
diff --git a/config.ru b/config.ru
new file mode 100644
index 00000000..060867f3
--- /dev/null
+++ b/config.ru
@@ -0,0 +1,35 @@
+require 'rubygems'
+require 'bundler/setup'
+require 'rack'
+
+# The project root directory
+$root = ::File.dirname(__FILE__)
+
+# Common Rack Middleware
+use Rack::ShowStatus # Nice looking 404s and other messages
+use Rack::ShowExceptions # Nice looking errors
+
+#
+# From Rack::DirectoryIndex:
+# https://github.com/craigmarksmith/rack-directory-index/
+#
+module Rack
+ class DirectoryIndex
+ def initialize(app)
+ @app = app
+ end
+ def call(env)
+ index_path = ::File.join($root, 'public', Rack::Request.new(env).path.split('/'), 'index.html')
+ if ::File.exists?(index_path)
+ return [200, {"Content-Type" => "text/html"}, [::File.read(index_path)]]
+ else
+ @app.call(env)
+ end
+ end
+ end
+end
+
+use Rack::DirectoryIndex
+
+run Rack::Directory.new($root + '/public')
+