=========================
iw_plone_project template
=========================

Check that the directory does not exist::

    >>> rmdir(tempdir, 'my_project')

Go to a directory::
    
    >>> cd(tempdir)

Then use paster::

    >>> paster('create -t iw_plone_project my_project --no-interactive')
    paster create -t iw_plone_project my_project --no-interactive
    Selected and implied templates:
    ...

Let's see what was generated::

    >>> ls(tempdir, 'my_project')
    - README.txt
    - base.cfg
    - dev.cfg
    d docs
    d downloads
    - prod.cfg

Let's check the content::

    >>> config_file = join(tempdir, 'my_project', 'base.cfg')
    >>> print open(config_file).read()
    [buildout]
    <BLANKLINE>
    parts =
        plone
        zope2
        ploneproducts
        zopepy
        zopeinstance
    <BLANKLINE>
    find-links =
        http://release.ingeniweb.com/third-party-dist
        http://dist.plone.org
        http://dist.plone.org/packages
        http://download.zope.org/distribution/
        http://products.ingeniweb.com/catalog/simple
        http://private-products.ingeniweb.com/catalog/simple
    <BLANKLINE>
    eggs =
        elementtree
        iw.mailhost
        collective.releaser
        iw.plonepatches    
        Sphinx
    <BLANKLINE>
    extensions = lovely.buildouthttp buildout.dumppickedversions
    dump-picked-versions-file = founded_versions.cfg
    versions = versions
    <BLANKLINE>
    [versions]
    # to be completed
    <BLANKLINE>
    [plone]
    # remove the version and fix it in [versions] asap
    recipe = plone.recipe.plone>=3.1.1,<3.2dev
    <BLANKLINE>
    [ploneproducts]
    recipe = plone.recipe.distros
    urls = 
    nested-packages = 
    version-suffix-packages = 
    <BLANKLINE>
    [zope2]
    recipe = plone.recipe.zope2install
    url = ${plone:zope2-url}
    <BLANKLINE>
    [zopepy]
    recipe = zc.recipe.egg
    eggs = ${zopeinstance:eggs}
    interpreter = zopepy
    extra-paths = ${zope2:location}/lib/python
    <BLANKLINE>
    [zopeinstance]
    recipe = plone.recipe.zope2instance
    zope2-location = ${zope2:location}
    user = admin:admin
    http-address = 8080
    debug-mode = on 
    verbose-security = on
    <BLANKLINE>
    eggs =
        ${buildout:eggs}
        ${plone:eggs}
    <BLANKLINE>
    products =
        ${plone:products}
    <BLANKLINE>
    <BLANKLINE>

We want to build it to make sure everything works::

    >>> build(config_file)
    Creating ...
    ...
    Generated interpreter '...zopepy'.
    >>> ls(os.path.dirname(config_file))
    - .installed.cfg
    - README.txt
    - base.cfg
    d bin
    - dev.cfg
    ...
    d parts
    - prod.cfg
    d var

Let' try the prod version::

    >>> config_file = join(tempdir, 'my_project', 'prod.cfg')
    >>> build(config_file)
    Getting...
    ...
    Generated script '...'.
    
What do we have::

    >>> ls(os.path.dirname(config_file))
    - .installed.cfg
    - README.txt
    - base.cfg
    d bin
    - dev.cfg
    ...
    d parts
    - prod.cfg
    d var

We should have a rotatezlog added::

    >>> print open(join('parts', 'zopeinstance', 'etc', 'zope.conf')).read()
    %define INSTANCEHOME /tmp/my_project/parts/zopeinstance
    instancehome $INSTANCEHOME
    %define CLIENTHOME /tmp/my_project/var/zopeinstance
    clienthome $CLIENTHOME
    <BLANKLINE>
    products /tmp/my_project/parts/plone
    debug-mode on
    security-policy-implementation python
    verbose-security on
    default-zpublisher-encoding utf-8
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    <eventlog>
      level INFO
    <BLANKLINE>
    %import iw.rotatezlogs
    <rotatelogfile>
    path /tmp/my_project/var/log/instance.log
    max-bytes 1MB
    backup-count 5
    </rotatelogfile>
    </eventlog>
    <BLANKLINE>
    <logger access>
      level WARN
    <BLANKLINE>
    %import iw.rotatezlogs
    <rotatelogfile>
    path /tmp/my_project/var/log/instance-Z2.log
    max-bytes 1MB
    backup-count 5
    </rotatelogfile>
    </logger>
    <BLANKLINE>
    <http-server>
      # valid keys are "address" and "force-connection-close"
      address 8080
      # force-connection-close on
      # You can also use the WSGI interface between ZServer and ZPublisher:
      # use-wsgi on
    <BLANKLINE>
    </http-server>
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    <zodb_db main>
        # Main database
        cache-size 5000
    <BLANKLINE>
    # FileStorage database
        <filestorage>
          path /tmp/my_project/var/filestorage/Data.fs
        </filestorage>
        mount-point /
    </zodb_db>
    <BLANKLINE>
    <zodb_db temporary>
        # Temporary storage database (for sessions)
        <temporarystorage>
          name temporary storage for sessioning
        </temporarystorage>
        mount-point /temp_folder
        container-class Products.TemporaryFolder.TemporaryContainer
    </zodb_db>
    <BLANKLINE>
    pid-filename /tmp/my_project/var/zopeinstance.pid
    lock-filename /tmp/my_project/var/zopeinstance.lock
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>

