Skip to content

Instantly share code, notes, and snippets.

@stevenschobert
Created February 20, 2014 19:57
Show Gist options
  • Select an option

  • Save stevenschobert/9121925 to your computer and use it in GitHub Desktop.

Select an option

Save stevenschobert/9121925 to your computer and use it in GitHub Desktop.
Starter set of files for a simple rack app. Useful for quickly deploying static sites to something like Heroku, or using Pow for editing static sites.
require 'rack'
root = "public"
use Rack::Static,
:urls => Dir.glob("#{root}/*").map { |fn| fn.gsub(/#{root}/, '')},
:root => root,
:index => 'index.html',
:header_rules => [[:all, {'Cache-Control' => 'public, max-age=3600'}]]
run Proc.new {|env|
[
200,
{"Content-Type" => "text/html"},
File.open('public/index.html', File::RDONLY)
]
}
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rack'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment