Last active
December 22, 2015 03:59
-
-
Save sawanoboly/6413893 to your computer and use it in GitHub Desktop.
Sphinxで作成したドキュメントをherokuでホスティング、Continuous Documentationなススメ(Basic認証付き) ref: http://qiita.com/sawanoboly/items/be1dbc9f19e93e4b62cf
This file contains hidden or 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
require 'sinatra' | |
set :public_folder, File.dirname(__FILE__) + '/build/html' | |
get '/' do | |
redirect "/index.html", 301 | |
end | |
run Sinatra::Application |
This file contains hidden or 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
require 'sinatra' | |
set :public_folder, File.dirname(__FILE__) + '/build/html' | |
## >>>追記部分 | |
use Rack::Auth::Basic do |username, password| | |
username == 'hogehoge' && password == 'mogemoge' | |
end | |
before '*' do | |
# authenticate! | |
end | |
## <<<<追記部分 | |
get '/' do | |
redirect "/index.html", 301 | |
end | |
get '/:dir' do ## 修正2,3 | |
unless request.path_info.end_with?('.ico') | |
redirect "#{request.path_info}.html", 301 | |
end | |
end | |
run Sinatra::Application |
This file contains hidden or 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
$ git push heroku | |
Counting objects: 38, done. | |
Delta compression using up to 4 threads. | |
Compressing objects: 100% (37/37), done. | |
Writing objects: 100% (37/37), 148.40 KiB, done. | |
Total 37 (delta 4), reused 0 (delta 0) | |
-----> Ruby/Rack app detected | |
-----> Using Ruby version: ruby-2.0.0 | |
-- snip -- | |
-----> Compiled slug size: 26.2MB | |
-----> Launching... done, v4 |
This file contains hidden or 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
web: bundle exec rackup -p $PORT |
This file contains hidden or 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
source "https://rubygems.org" | |
gem "sinatra" | |
gem "rake" | |
gem "thin" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment