======
Deploy
======

With buildout.cfg
-----------------

Test with default config file::

  >>> from iw.releaser.testing import clearRepository
  >>> clearRepository(test)

Deploy::

  >>> url = svn_url + '/sample-buildout/trunk'
  >>> from iw.releaser.project import deploy_release
  >>> deploy_release(url, sample_buildout, 'full')
  Checking python version ...
  ...

Checking cfg::

  >>> cat(sample_buildout, 'buildout.cfg')
  [buildout]
  download-cache = downloads
  offline = true
  parts = 
  install-from-cache = true
  <BLANKLINE>

Check tarball::

  >>> parent_dir = os.path.split(sample_buildout)[0]

  >>> ls(parent_dir)
  -  buildout.tar.gz
  d  sample-buildout

Cant unarchive contents with python ::

  >>> #from iw.releaser.base import TarFile
  >>> #tar = TarFile(os.path.join(parent_dir, 'buildout.tar.gz'), 'r')
  >>> #for fileinfo in tar.getmembers():
  >>> #    print fileinfo.name

With sample.cfg
-----------------

Test with default config file::

  >>> from iw.releaser.testing import clearBuildout
  >>> clearBuildout(test)
  >>> write(sample_buildout, 'buildout.cfg','''
  ... [buildout]
  ... parts=
  ... download-cache = downloads
  ... ''')

  >>> write(sample_buildout, 'sample.cfg','''
  ... [buildout]
  ... parts=
  ... download-cache = downloads
  ... ''')

Deploy::

  >>> from iw.releaser.project import deploy_release
  >>> deploy_release(join(sample_buildout, 'sample.cfg'),
  ...                archiving='full')
  Checking python version ...
  ...

buildout.cfg must extend sample.cfg::

  >>> cat(sample_buildout, 'buildout.cfg')
  [buildout]
  install-from-cache = true
  parts = 
  extends = sample.cfg
  download-cache = downloads
  offline = true
  <BLANKLINE>

Check the `.snapshot` file::

  >>> cat(sample_buildout, '.snapshot')
  eggs/setuptools-...egg
  eggs/zc.buildout-...egg

Check tarball::

  >>> parent_dir = os.path.split(sample_buildout)[0]

  >>> ls(parent_dir)
  d  sample-buildout
  -  sample.tar.gz

With developer.cfg
------------------

Making sure a develop stops the release.

Test with default config file::

  >>> from iw.releaser.testing import clearBuildout
  >>> clearBuildout(test)
  >>> write(sample_buildout, 'buildout.cfg','''
  ... [buildout]
  ... parts=
  ... download-cache = downloads
  ... ''')

  >>> write(sample_buildout, 'developer.cfg','''
  ... [buildout]
  ... parts=
  ...
  ... develop =
  ...       /my/package
  ... ''')

Deploy::

  >>> from iw.releaser.project import deploy_release
  >>> deploy_release(join(sample_buildout, 'developer.cfg'),
  ...                archiving='full')
  Traceback (most recent call last):
  ...
  ReleaseError: 
    You need to make releases of theses packages:
      /my/package

With developer.cfg
------------------

Making sure a missing download-cache stops the release.

Test with default config file::

  >>> from iw.releaser.testing import clearBuildout
  >>> clearBuildout(test)
  >>> write(sample_buildout, 'buildout.cfg','''
  ... [buildout]
  ... parts=
  ... download-cache = downloads
  ... ''')

  >>> write(sample_buildout, 'developer.cfg','''
  ... [buildout]
  ... parts=
  ...
  ... ''')

Deploy::

  >>> from iw.releaser.project import deploy_release
  >>> deploy_release(join(sample_buildout, 'developer.cfg'),
  ...                archiving='full')
  Traceback (most recent call last):
  ...
  ReleaseError: You need to add 'download-cache = downloads'' in the [buildout] section

Making a snapshot
-----------------

Making sure a missing download-cache stops the release.

Test with default config file::

  >>> from iw.releaser.testing import clearBuildout
  >>> clearBuildout(test)
  >>> write(sample_buildout, 'buildout.cfg','''
  ... [buildout]
  ... parts=
  ... download-cache = downloads
  ... ''')

  >>> write(sample_buildout, 'developer.cfg','''
  ... [buildout]
  ... parts=
  ... download-cache = downloads
  ... ''')

Deploy::

  >>> from iw.releaser.project import deploy_release
  >>> deploy_release(join(sample_buildout, 'developer.cfg'),
  ...                archiving=url)
  Checking python version ...
  2.4 ok.
  Using local directory /... with developer.cfg
  New python executable in ./bin/python
  Installing setuptools.............................done.
  Checking binary.
  bin/buildout ok.
  <BLANKLINE>
  Archiving /...
  developer.tar.gz ok.

