[Heroku] 静的ページをアップロードする方法
Heroku に静的ページをアップロードする方法をご紹介します。
ほぼ、公式ドキュメント通りです。
Creating Static Sites in Ruby with Rack | Heroku Dev Center
$ mkdir -p bakorer-com/public/{images,js,css}
$ touch bakorer-com/{config.ru,public/index.html}
$ cd bakorer-com && bundle init
Writing new Gemfile to /Users/bakorer/git/bakorer-com/Gemfile
$ tree ./
./
├── Gemfile
├── config.ru
└── public
├── css
├── images
├── index.html
└── js
4 directories, 3 files
# Gemfile:
source :rubygems
gem 'rack'
bundle install
# config.ru: use Rack::Static, :urls => ["/images", "/js", "/css"], :root => "public" run lambda { |env| [ 200, { 'Content-Type' => 'text/html', 'Cache-Control' => 'public, max-age=86400' }, File.open('public/index.html', File::RDONLY) ] } |
$ rackup
[2013-04-28 11:04:24] INFO WEBrick 1.3.1
[2013-04-28 11:04:24] INFO ruby 1.9.3 (2013-02-22) [x86_64-darwin12.2.1]
[2013-04-28 11:04:24] INFO WEBrick::HTTPServer#start: pid=41780 port=9292
$ heroku create bakorer-com
Creating bakorer-com... done, region is us
http://bakorer-com.herokuapp.com/ | git@heroku.com:bakorer-com.git
git init
git add -A
git commit -m "Initial static site template app"
git push heroku master
heroku open
以上、Heroku に静的ページをアップロードしたい、現場からお送りしました。