Metadata-Version: 2.1
Name: plonecli
Version: 0.3.0
Summary: A Plone CLI for creating Plone packages
Home-page: https://github.com/plone/plonecli
Author: Maik Derstappen
Author-email: md@derico.de
License: BSD License
Keywords: plonecli
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Topic :: Software Development :: Code Generators
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Utilities
Classifier: Environment :: Console
Classifier: Framework :: Plone
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Requires-Dist: setuptools
Requires-Dist: virtualenv
Requires-Dist: Click (>=7.0)
Requires-Dist: mr.bob
Requires-Dist: zest.releaser
Requires-Dist: bobtemplates.plone (>=3.4.3)
Provides-Extra: dev
Requires-Dist: tox; extra == 'dev'
Requires-Dist: zest.releaser[recommended]; extra == 'dev'
Provides-Extra: test
Requires-Dist: pytest; extra == 'test'

.. image:: https://secure.travis-ci.org/plone/plonecli.png?branch=master
    :target: http://travis-ci.org/plone/plonecli

.. image:: https://coveralls.io/repos/github/plone/plonecli/badge.svg?branch=master
    :target: https://coveralls.io/github/plone/plonecli?branch=master
    :alt: Coveralls

.. image:: https://img.shields.io/pypi/v/plonecli.svg
    :target: https://pypi.python.org/pypi/plonecli/
    :alt: Latest Version

=========
Plone CLI
=========

.. image:: https://github.com/plone/plonecli/blob/master/docs/plone_cli_logo.svg


**A Plone CLI for creating Plone packages**

*The Plone CLI is meant for developing Plone packages, we will not add functions to install or run Plone in production. For this we should build another package, let's say *plonectl* which will provide installing and deployment functions. It also support's GIT by default, to keep track of changes one is doing with the templates.*


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

We install plonecli in the global user site-packages, so that we can use it in multible projects.

Versions newer than 0.1.1b4 are installable like any other package with pip:

.. code-block:: console

    $ pip install plonecli --user
    $ plonecli -l

To upgrade plonecli just do:

.. code-block:: console

    $ pip install -U plonecli --user


NOTE:
We are now using a the ORIGINAL version of the CLICK library, please uninstall plonecli-click before you install the new version of plonecli.

If would like to use plonecli with pipenv, you can do it as follow:

.. code-block:: console

    $ mkdir cli
    $ cd cli
    $ pipenv install plonecli
    $ pipenv shell
    $ plonecli -l


Bash Auto Completion
--------------------

To enable auto completion plonecli provides the plonecli_autocomplete.sh script, put the following bash command into your bashrc:

If you installed plonecli in user global packages:

.. code-block:: console

    $ . ~/.local/bin/plonecli_autocomplete.sh


If you installed plonecli in a virtualenv it's:

.. code-block:: console

    $ . /path/to/your/virtualenv/bin/plonecli_autocomplete.sh


If you used pipenv to install plonecli, you have to find out the path to the virtualenv before:

.. code-block:: console

    $ pipenv --virtualenv
    /home/maik/.local/share/virtualenvs/pe-WnXOnVWH
    . /home/maik/.local/share/virtualenvs/pe-WnXOnVWH/bin/plonecli_autocomplete.sh


Documentation
=============

Full documentation for end users can be found in the "docs" folder, this will be available in the Plone docs at some point.

*Note:* you can set default answers for mr.bob questions, see `bobtemplates.plone README <https://github.com/plone/bobtemplates.plone/#configuration>`_.

Usage
=====

Available Commands
------------------

.. code-block:: console

    $ plonecli --help
    Usage: plonecli [OPTIONS] COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]...

      Plone Command Line Interface (CLI)

    Options:
      -l, --list-templates
      -V, --versions
      -h, --help            Show this message and exit.

    Commands:
      build         Bootstrap and build the package
      buildout      Run the package buildout
      config        Configure mr.bob global settings
      create        Create a new Plone package
      debug         Run the Plone client in debug mode
      requirements  Install the local package requirements
      serve         Run the Plone client in foreground mode
      test          Run the tests in your package
      virtualenv    Create/update the local virtual environment...


Creating A Plone Add-on
-----------------------

.. code-block:: console

    $ plonecli -l
    Available mr.bob templates:
    - addon
     - behavior
     - content_type
     - portlet
     - theme
     - theme_barceloneta
     - view
     - viewlet
     - vocabulary
    - buildout
    - theme_package [deprecated] >> Please use the theme_barceloneta subtemplate!

    $ plonecli create addon src/collective.todo


Adding Features To Your Plone Add-on
------------------------------------

You can add different features thru subtemplates. You can use them also multible time to create different features of the same typ, like two different content types.

.. code-block:: console

    $ cd collective.todo

    $ plonecli add behavior
    $ plonecli add content_type
    $ plonecli add theme
    $ plonecli add view
    $ plonecli add viewlet
    $ plonecli add vocabulary


Build Your Package
------------------

.. code-block:: console

    $ plonecli build

This will run:

.. code-block::

    $ virtualenv .
    $ ./bin/pip install -r requirements.txt --upgrade
    $ ./bin/buildout

in your target directory.

You can always run the 3 steps explicit by using ``virtualenv``,``requirements``, ``buildout`` instead of build.
If you want to reset your build use the ``--clean`` option on build.
This will clear your virtualenv before installing the requirements and also running buildout with ``-n`` to get the newest versions.


Run Your Application
--------------------

.. code-block:: console

    $ plonecli serve


Run Tests for Application
-------------------------

.. code-block:: console

    $ plonecli test

or run specific tests:

.. code-block:: console

    $ plonecli test -t test_the_thing

or run all tests including Robot tests:

.. code-block:: console

    $ plonecli test --all


Combining Commands
------------------

You can combine the steps above like this:

.. code-block:: console

    $ plonecli create addon src/collective.todo build test --all serve


Developer Guide
===============

Setup Developer Environment
---------------------------

.. code-block:: console

    $ git clone https://github.com/plone/plonecli/
    $ cd plonecli
    $ virtualenv .
    $ source bin/activate
    $ pip install -r requirements.txt
    $ python setup.py develop
    $ plonecli --help


Running Tests
-------------

You can run the tests using the following command:

.. code-block:: console

    $ tox

or by installing py.test and run the test directly without tox:

.. code-block:: console

    $ py.test test/

or a single test:

.. code-block:: console

    $ py.test test/ -k test_get_package_root


Register Your Bobtemplates Package For Plonecli
-----------------------------------------------

All mr.bob templates can be registered for plonecli by adding an entry_point to your setup.py.

Here are the entry_points of the bobtemplates.plone package:

.. code-block:: python

    entry_points={
        'mrbob_templates': [
            'plone_addon = bobtemplates.plone.bobregistry:plone_addon',
            'plone_buildout = bobtemplates.plone.bobregistry:plone_buildout',  # NOQA E501
            'plone_theme_package = bobtemplates.plone.bobregistry:plone_theme_package',  # NOQA E501
            'plone_content_type = bobtemplates.plone.bobregistry:plone_content_type',  # NOQA E501
            'plone_theme = bobtemplates.plone.bobregistry:plone_theme',
            'plone_vocabulary = bobtemplates.plone.bobregistry:plone_vocabulary',  # NOQA E501
        ],
    },

The entry_point name is used as the global template name for mr.bob.
You also need to provide the bobregistration.py file with the related methods, which should be named after the entry_point name:

.. code-block:: python

    # -*- coding: utf-8 -*-


    class RegEntry(object):
        def __init__(self):
            self.template = ''
            self.plonecli_alias = ''
            self.depend_on = None


    # standalone template
    def plone_addon():
        reg = RegEntry()
        reg.template = 'bobtemplates.plone:addon'
        reg.plonecli_alias = 'addon'
        return reg


    # sub template
    def plone_theme():
        reg = RegEntry()
        reg.template = 'bobtemplates.plone:theme'
        reg.plonecli_alias = 'theme'
        reg.depend_on = 'plone_addon'
        return reg

For every template you add a line to the entry_points and define a method in the bobregistry.py, which will return a registry object with some properties.

- ``template`` - contains the name of the actual mr.bob template.
- ``plonecli_alias`` - defines the name under which the template will be used inside plonecli
- ``depend_on``:
    1. for a standalone template, the depend_on property is None
    2. for a sub template, the depend_on contains the name of the parent standalone template, usualy `addon`.


Contribute
==========

- Issue Tracker: https://github.com/plone/plonecli/issues
- Source Code: https://github.com/plone/plonecli


License
=======

This project is licensed under the BSD license.

History
=======

0.3.0 (2018-10-17)
------------------

- Sort templates on --list-templates/-l command output
  [MrTango]

- Show deprecate flag and info for templates in template list
  [MrTango]

- Use the now released click library in version >= 7.0, you have to uninstall plonecli-click before upgrading!
  [MrTango]

0.2.2 (2018-08-13)
------------------

- Add -t and -s options to the test command
  [kakshay21]

- Fix #33 ConfigParser.NoOptionError
  [kakshay21]


0.2.1 (2018-07-09)
------------------

- Add plonecli config command to configure mrbob's global user settings
  [kakshay21]

- Add versions -V/--versions command
  [kakshay21]

- Add document commends -h, -V, test and config in README
  [kakshay21]


0.2.0 (2018-04-03)
------------------

- Add test command to allow running test from plonecli
  [MrTango]


0.1.1 (2018-03-28)
------------------

- Improve command line output with colors and remove verbose option
  [MrTango]

- Add virtualenv as requirement and improve README
  [MrTango]


0.1.1b6 (2018-03-28)
--------------------

- fix autocomletion for top level commands
  [MrTango]


0.1.1b5 (2018-03-27)
--------------------

- use bobtemplates.plone>=3.0.0b5
  [MrTango]


0.1.1b4 (2018-03-26)
--------------------

- Use a forked version of click library (plonecli-click) as dependency for now
  [MrTango]


0.1.1b3 (2018-03-23)
--------------------

- Fix broken release


0.1.1b2 (2018-03-22)
--------------------

- Fix dist on pypi


0.1.1b1 (2018-03-22)
--------------------

- Add requirements.txt referencing the special Click version.
  This makes a ``pip`` installation possible.
  [jensens]
- Refactored registry to use the new bobtemplate.cfg
  [MrTango]


0.1.0a4 (2017-10-30)
--------------------

- provide plonecli_autocomplete.sh for bash autocompletion
  [MrTango]
- fix depency to bobtemplates.plone, we need >=3.0.0a3
  [MrTango]


0.1.0a3 (2017-10-24)
--------------------

- Update README to use easy_install instead of pip for now
  [MrTango]


0.1.0a2 (2017-10-24)
--------------------

- fix setup.py to use the github version of click, until click >6.7 is released
  [MrTango]


0.1.0a1 (2017-10-24)
--------------------

- initital version with list templates support and bobtemplates.plone integration
  [MrTango, tmassman, Gomez]


