Skip to content

Instantly share code, notes, and snippets.

@ryanjones
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanjones/9862092 to your computer and use it in GitHub Desktop.
Save ryanjones/9862092 to your computer and use it in GitHub Desktop.
Quick html site on heroku w/ rack
## 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