Project

General

Profile

Actions

Feature #11963

closed

Add a simple static web server to `ruby`

Added by sgharms (STeven Harms) about 8 years ago. Updated almost 3 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:72739]

Description

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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0