Announcing: lein-simpleton
At various times I’ve needed something very similar to python -m SimpleHTTPServer <port>
readily accessible in my Clojure projects. Most of the time I just used Python but recently I’ve wanted to rework some examples from The Joy of Clojure and thought a simple Lein plugin would make a nice addition. The result: lein-simpleton — I hope you’ll find it useful.
Usage
See the lein-simpleton project page for installation instructions for the latest version.
Running
By default Simpleton provides a file-server in the directory where it’s run. To run:
$ lein simpleton <port>
Navigate to localhost:<port>
and see a directory listing. Click around to navigate directories and download (some) files.
Running the echo server
Simpleton can also run an echo server that reflects the incomming HTTP headers back as EDN data.
$ lein simpleton <port> echo
Navigating to localhost:<port>
to download an EDN file.
Running the hello server
Simpleton can also run a “Hello” server that just returns a canned text string.
$ lein simpleton <port> hello
Navigating to localhost:<port>
to see the message.
That’s all for now.
:F
8 Comments, Comment or Ping
Scott Parker
This is great news, and will go straight into my profiles.clj. I’ve long had an alias in my terminal for doing just that, but that means python becomes a dependency.
Yay! Thank you!
Apr 9th, 2013
Max Gonzih
Am I doing something wrong?
Apr 9th, 2013
fogus
@Max
Try the 1.0.1 version. I forgot some metadata needed by Leiningen.
Apr 9th, 2013
Max Gonzih
@fogus
Updated plugin to 1.0.1 (just saw your commit), all works fine.
Thank you for being awesome :)
Apr 9th, 2013
Igor
Can’t access a file with spaces in its name. The output is like that:
Starting file server on port 2000
./File%20With%20Spaces (No such file or directory)
Apr 10th, 2013
Igor
Simpleton doesn’t have a help string. Instead, when I run “lein help” the last line of output is “Shutting down Simpleton…”
Apr 11th, 2013
fogus
@Igor the v1.0.2 version should fix the problems that you were experiencing.
Apr 11th, 2013
Igor
Thanks! The most useful web server I ever used, seriously! (oh, and I just found out that it can’t handle files with \’ in their names…)
Apr 11th, 2013
Reply to “Announcing: lein-simpleton”