Issue #11963 has been updated by Martin Drst.


I guess somebody providing code/a patch would go a long way to moving this issue forward. The invocation syntax is probably a detail that will solve itself somehow when we have an implementation.

As to introducing another way to do things, of course we shouldn't introduce it if it isn't an improvement. But if we are too afraid of people on old versions being frustrated, we might never be able to move forward on any improvement to Ruby.

----------------------------------------
Feature #11963: Add a simple static web server to `ruby`
https://bugs.ruby-lang.org/issues/11963#change-56006

* Author: STeven Harms
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
# Introduction

"Good artists copy, great artists steal." - Pablo Picasso

`python -m SimpleHTTPServer` starts a static webserver in the local directory. It is
helpful in many surprising ways. Ruby lacks a similar idiom.  I advocate that
Ruby offer something similar.

# State of the Art

A cursory search shows that this question has been asked a number of times (e.g. StackOverflow, blog posts) and
it seems we have, as a community, yet to agree on a simple, clean standard.  I
believe the best and shortest chant is the following:

`ruby -run -e httpd . -p <PORT>`

I believe this chant is attributable to Aaron Patterson.

I find this invocation unsatisfying. First, the use of `un.rb` is, admittedly, quite
clever, but therefore also somewhat hard to reason about. *IF* we're going to
require users to be able to reason about `-r 'un'`, let's ease their burdens and
create a magic flag for `ruby` to run an in-place static server.

# Suggested Semantics

`ruby -simplewebserver [-p port]`

# Do Not Use -m

`-m` suggests module or something similar and I don't want to confuse our
HONORING Python by inappropriately copying their module semantics

# Conclusion

At the very least, if this request is denied I'd like to have in the searchable
archives why Ruby doesn't support this capability provided by its "cousin,"
Python.




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>