Package: valet
Introductionvaletis a script that turns any directory into a simple wiki, complete with wikitext rendering, editing, and automatically committing changes to version control.It’s a single file with no strict requirements aside from [bottle](http://bottlepy.org/).News2015-01-03I got a bee in my bonnet recently on making some improvements tovalet, so Merry Christmas to you all.New features:The/view/X,/edit/X, etc. paths have been removed in favor of using URL query arguments, e.g.X?editandX?delete. CGI/WSGI path prefixes still work fine.New file-management-related functionality, like creating new files and deleting filesSearch! A fancy search field will grep through documents and filenames for your queryLots of git-related functionality has been added, including:Displaying a dropdown that lets you view an old version of a fileDisplaying a table with detailed status about the last few changes to a fileLots of code cleanup, refactoring, and simplificationFixed a ton of bugsLots of code changes to better comply with pylint (score 9.24)Added some basic unit/regression tests intests.py2012-10-28I spent some time hacking onvaletthis weekend, fixing a few bugs and adding one big new feature: CGI/WSGI support. Now if you link or renamevalettosomething.cgiorsomething.fcgi, it will “Do The Right Thing” and operate as a proper webapp. (WSGI support requires [flup](http://trac.saddi.com/flup).)This feature was required for me to runvaletas a lightweight wiki on my DreamHost server without interfering in that environment by opening a new port or leaving a long-running service around. I didn’t add a configuration interface; if you’re going to be linking or renaming the script, open it up and change the options hard-coded near the top.Other changes and new features:Added amimequery argument to override the automatic filetype detection.You can use this if, for instance, you have a Python script without the “.py” extension; add?mime=text/x-pythonto get it properly syntax-colored anyway.Added support for arbitrary URL prefixes.This just works automatically;valetwill figure out where you put it and prepend that to all of the links instead of hardcoding “/view” etc.This doesn’t work super-well with Apache’smod_rewrite; it basically ignores the rewrite headers. This is a limitation ofbottlebut I’m not sure how to do it better anyway.Fixes:Added proper support for empty “edit” and “post” routes with a slash at the end (now it will complain about no file being provided instead of saying the route doesn’t exist)Fixed an error output that caused problems when running as a CGI (now writes to stderr)Usage$ valetOr, use some command line options:$ valet [-d <path>] [-p <port>] [-r] [-s] [-v]By default,valetserves$CWD; change this with-d <path>.
Other options:-r: set readonly mode and disable editing-s: set simple mode and disable all special-case processing (pygments, wikitext rendering, etc.)-v: automatically commit edits into version control if possibleCurrently only git is supported.Installation$ pip install valetRequirementsPython 2.6+[bottle](http://bottlepy.org/)Tested on:Centos 5.4 (python 2.6)Debian 6.0.4 (python 2.6)Gentoo (python 2.7)Mac OS X 10.7 (python 2.7)Ubuntu 12.04.1 (python 2.7)Windows 7 (python 2.7)Optional Componentsvaletsupports lots of useful modules, which will be automatically enabled if present:[python-magic](http://pypi.python.org/pypi/python-magic/): Better automatic file type detection[Markdown](http://pypi.python.org/pypi/Markdown/): Render “markdown” wikitext in files[python-creole](http://pypi.python.org/pypi/python-creole/): Render “creole” wikitext in files[textile](http://pypi.python.org/pypi/textile): Render “textile” wikitext in files[docutils](http://pypi.python.org/pypi/docutils/): Render “reStructuredText” wikitext in files[pygments](http://pypi.python.org/pypi/Pygments): Adds syntax highlighting for source code filesUse the-s/–simplecommand-line option to disable these optional components.Known IssuesThere’s no security anywhere here; please, whatever you do, DON’T make this available over the Internet.valethas a readonly mode and attempts to jail reads and edits into its root directory, but be careful!bottle’sstatic_filefunction doesn’t appear to handle UTF-8 data properly, or at least it doesn’t show up right when I load a file that way.The version ofpython-magicthat ships with Ubuntu [is broken](https://bugs.launchpad.net/bugs/603128); I worked around it as best I could.