Last active
December 21, 2015 05:49
-
-
Save s-shin/6259910 to your computer and use it in GitHub Desktop.
ワーキングディレクトリをパプリックディレクトリにする簡易サーバ。ローカル内でファイル転送したい時に便利。
$ ruby -e "$(curl -fsSL https://gist.github.com/s-shin/6259910/raw/torimasaba.rb)" で一時保存も必要なし。
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 "webrick" | |
| server = WEBrick::HTTPServer.new({ | |
| DocumentRoot: "./", | |
| Port: ARGV[0] ? ARGV[0].to_i : 8080, | |
| MimeTypes: WEBrick::HTTPUtils::DefaultMimeTypes.merge({ | |
| "js" => "application/javascript" | |
| }) | |
| }) | |
| server.mount("/", WEBrick::HTTPServlet::FileHandler, Dir.pwd, {FancyIndexing: true}) | |
| trap("INT") { server.shutdown } | |
| server.start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment