sauna.reload

HomePage: http://github.com/collective/sauna.reload

Author: Asko Soukka

Download: https://pypi.python.org/packages/source/s/sauna.reload/sauna.reload-0.5.1.zip

        .. figure:: https://github.com/collective/sauna.reload/raw/gh-pages/saunasprint_logo.jpg

*sauna.reload: so that you can finish your Plone development today and relax in
sauna after calling it a day*

.. contents:: :local:


Introduction
============

``sauna.reload`` is a developer tool which restarts Plone and reloads your changed source
code every time you save a file. The restart is optimized for speed
and happens much faster than a normal start up process.

* Edit your code
* Save
* Go to a browser and hit *Refresh* |->| your latest changes are active

It greatly simplifies your Plone development workflow and gives back the
agility of Python.

It works with any code.

``sauna.reload`` works on OSX and Linux with Plone 4.0 and 4.1. In theory
works on Windows, but no one has looked into that yet.

.. |->| unicode:: U+02794 .. thick rightwards arrow


User comments
-------------

"I don't want to use sauna.reload as I can knit a row while I restart ..."

"no more do I start a 5 minute cigarette every time Plone restarts for 30
seconds... ok wait, this kind of joy leads to poetry, I'm gonna stop here."


Installation
============

Here are brief installation instructions.


Prerequisitements
-----------------

In order to take the advantage of ``sauna.reload``

* You know how to develop your own Plone add-ons and basics of buildout folder
  structure

* You know UNIX command line basics

* You know how to run buildout

* You are running Linux or OSX operating system

No knowledge for warming up sauna is needed in order to use this product.

Installing buildout configuration
---------------------------------

The recommended installation configuration is to use ZEO server + 1 client for the development.
This method is valid for **Plone 4.1 and higher**. You can use ``sauna.reload``
without separate ZEO database server, using ``instance`` command,
but
`in this case you'll risk database corruption on restarts <http://collective-docs.readthedocs.org/en/latest/troubleshooting/exceptions.html>`_.

Below is the recommended approach how to enable ``sauna.reload`` for your
development environment. However, since this product is only for development
use the data loss should not be a big deal.

Add ``sauna.reload`` to your ``buildout.cfg`` file:

``buildout.cfg``::

  [buildout]
  eggs +=
      sauna.reload

  # This section is either client1 / instance depending
  # on your buildout
  [instance]
  zope-conf-additional = %import sauna.reload

OSX notes
+++++++++

If you are using vim (or macvim) on OSX, you must disable vim's writebackups
to allow WatchDog to see your modifications
(otherwise vim will technicallyj create a new file on each save and WatchDog
doesn't report the modification back to ``sauna.reload``).

So, Add the following to the end of your ``.vimrc``::

  set noswapfile
  set nobackup
  set nowritebackup

Similar issues have been reported with some other OSX-editors.
Tips and fixes for these are welcome.


Ubuntu / Debian / Linux notes
+++++++++++++++++++++++++++++

You might need to raise your open files *ulimit* if you are operating on the
large set of files, both hard and soft limit.

* http://posidev.com/blog/2009/06/04/set-ulimit-parameters-on-ubuntu/

104000 is a known good value.

If your *ulimit* is too low you'll get very misleading *OSError: No space left
on device*.


Usage: start Plone in reload enabled manner
===========================================

To start Plone with reload functionality you need
to give special environment variable ``RELOAD_PATH``
for your client1 command::

  # Start database server
  bin/zeoserver start

  # Start Plone with reload enabled
  RELOAD_PATH=src bin/client1 fg

Or if you want to optimize load speed you can directly specify only some of
your development products::

  RELOAD_PATH=src/my.product:src/my.another.product bin/client1 fg

.. warning:: If other products depend on your product, e.g CMFPlone
   dependencies, sauna.reload does not kick in early enough and the reload does
   not work.

When reload is active you should see something like this in your console
wh