could someone give me a hint, howto serve the current directory from command line with ruby? it would be great, if i can have some system wide configuration (e.g. mime-types) and simply launch it from every directory.
相关问题
- How to specify memcache server to Rack::Session::M
- Why am I getting a “C compiler cannot create execu
- reference to a method?
- ruby 1.9 wrong file encoding on windows
- gem cleanup shows error: Unable to uninstall bundl
相关文章
- Ruby using wrong version of openssl
- Difference between Thread#run and Thread#wakeup?
- how to call a active record named scope with a str
- “No explicit conversion of Symbol into String” for
- Segmentation fault with ruby 2.0.0p247 leading to
- How to detect if an element exists in Watir
- uninitialized constant Mysql2::Client::SECURE_CONN
- ruby - simplify string multiply concatenation
You can use the
sinatra
gem, though it doesn't do any directory listing for you, it serves files:then run that as a file, if in 1.8 add require 'rubygems' to the top first.
After running it then url's like
http://localhost:4567/file_name
should resolve to "./file_name" file.
http://localhost:4567 won't work however, since it doesn't "do" directory listings. See https://stackoverflow.com/a/12115019/32453 for a workaround there.
I've never seen anything as compact as
for Ruby, Chris' answer shows up several times on Google.