Last active
August 29, 2015 13:57
-
-
Save ryanjones/9862092 to your computer and use it in GitHub Desktop.
Quick html site on heroku w/ rack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## run manually, currently not worth scripting. | |
## from https://devcenter.heroku.com/articles/static-sites-ruby | |
mkdir appname | |
mkdir -p site/public/{images,js,css} | |
touch site/{config.ru,public/index.html} | |
cd site && bundle init | |
echo -e "source :rubygems\ngem 'rack'" > Gemfile | |
bundle install | |
cat > config.ru << EOF | |
use Rack::Static, | |
:urls => ["/img", "/js", "/css", "/fonts"], | |
:root => "public" | |
run lambda { |env| | |
[ | |
200, | |
{ | |
'Content-Type' => 'text/html', | |
'Cache-Control' => 'public, max-age=86400' | |
}, | |
File.open('public/index.html', File::RDONLY) | |
] | |
} | |
EOF | |
cd .. | |
git init | |
heroku apps:create appname | |
git add . | |
git commit -m "initial commit" | |
git push heroku master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment