Package: plonecli
Plone CLIA Plone CLI for creating Plone packagesThe Plone CLI is meant for developing Plone packages, we willnotadd functions to install or run Plone in production.
For this we should build another package, let’s sayplonectlwhich will provide installing and deployment functions.It also support’s GIT by default, to keep track of changes one is doing with the templates.InstallationWe install plonecli in the global user site-packages, so that we can use it in multiple projects.Versions newer than 0.1.1b4 are installable like any other package with pip.pipinstallplonecli--userplonecli-lTo upgrade plonecli just do:pipinstall-Uplonecli--userNote:Sometimes it happens that you will have older versions of bobtemplates.plone in your system after upgrades.
The best way to solve this is, to uninstall bobtemplates.plone multiple times until it says, that there is no package installed anymore.Make sure that the install directory is in$PATH(e.g.export PATH=$PATH:$HOME/.local/bin/)Note:We are now using a the ORIGINAL version of theCLICKlibrary,
please uninstall plonecli-click before you install the new version of plonecli.If one would like to use plonecli with pipenv, you can do it as follow:mkdirclicdclipipenvinstallploneclipipenvshellplonecli-lThe same applies if you use other tools like pyenv virtualenv.NOTE:
When using tools like pyenv or pipenv, you should disable the local virtualenv creation by settingpackage.venv.disabled = yin your .mrbob config file.
You can also use plonecli config to generate the config for you.Installation on macOSAdd the following lines to your .bash_profile. After running pip you can see where the files are located depending on your system.# plonecliexportPATH="$HOME/Library/Python/3.7/bin:$PATH"source$HOME/Library/Python/3.7/bin/plonecli_autocomplete.shBash Auto CompletionTo 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:.~/.local/bin/plonecli_autocomplete.shIf you installed plonecli in a virtualenv it’s:./path/to/your/virtualenv/bin/plonecli_autocomplete.shIf you used pipenv to install plonecli, you have to find out the path to the virtualenv before:pipenv--virtualenv/home/maik/.local/share/virtualenvs/pe-WnXOnVWH./home/maik/.local/share/virtualenvs/pe-WnXOnVWH/bin/plonecli_autocomplete.shFor other shells than BASH, like Zsh or Fish consult the click-docs:https://click.palletsprojects.com/en/7.x/bashcomplete/#activationDocumentationFull 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, seebobtemplates.plone README.Details of the templates used by plonecli, you can find in the bobtemplates.plone documentation.https://bobtemplatesplone.readthedocs.ioUsageAvailable Commandsplonecli--helpUsage:plonecli[OPTIONS]COMMAND1[ARGS]...[COMMAND2[ARGS]...]...PloneCommandLineInterface(CLI)Options:-l,--list-templates-V,--versions-h,--helpShowthismessageandexit.Commands:buildBootstrapandbuildthepackagebuildoutRunthepackagebuildoutconfigConfiguremr.bobglobalsettingscreateCreateanewPlonepackagedebugRunthePloneclientindebugmoderequirementsInstallthelocalpackagerequirementsserveRunthePloneclientinforegroundmodetestRunthetestsinyourpackagevenvCreate/updatethelocalvirtualenvironment...Creating A Plone Add-on$plonecli-lAvailable mr.bob templates:
 - addon
  - behavior
  - content_type
  - indexer
  - portlet
  - restapi_service
  - subscriber
  - svelte_app
  - theme
  - theme_barceloneta
  - upgrade_step
  - view
  - viewlet
  - vocabulary
  - buildout$ploneclicreateaddonsrc/collective.todoAdding Features To Your Plone Add-onYou can add different features through subtemplates. You can use them also multiple times to create different features of the same type, like two different content types.cdcollective.todoplonecliaddbehaviorplonecliaddcontent_typeplonecliaddthemeplonecliaddviewplonecliaddviewletplonecliaddvocabularyBuild Your PackageploneclibuildThis will run:python3-mvenvvenv./bin/pipinstall-rrequirements.txt--upgrade./bin/buildoutbootstrap./bin/buildoutin your target directory.You can always run the 3 steps explicit by usingvenv,requirements,buildoutinstead of build.
If you want to upgrade/reset your build use the--upgradeor--clearoption on build.This will clear your virtualenv before installing the requirements and also running buildout with-nto get the newest versions.Run Your ApplicationplonecliserveRun Tests for Applicationploneclitestor run specific tests:ploneclitest-ttest_the_thingor run all tests including Robot tests:ploneclitest--allCombining CommandsYou can combine the steps above like this:ploneclicreateaddonsrc/collective.todobuildtest--allserveDeveloper GuideSetup Developer Environmentgitclonehttps://github.com/plone/plonecli/cdploneclipython3-mvenvvenv../venv/bin/pipinstall-rrequirements.txt./venv/bin/pipinstall-e.[dev,test]plonecli--helpRunning TestsYou can run the tests using the following command:toxor by installing py.test and run the test directly without tox:py.testtest/or a single test:py.testtest/-ktest_get_package_rootRegister Your Bobtemplates Package For PlonecliAll mr.bob templates can be registered for plonecli by adding an entry_point to your setup.py.Here are some entry_points of the bobtemplates.plone package:entry_points={'mrbob_templates':['plone_addon = bobtemplates.plone.bobregistry:plone_addon','plone_buildout = bobtemplates.plone.bobregistry:plone_buildout',# NOQA E501'plone_content_type = bobtemplates.plone.bobregistry:plone_content_type',# NOQA E501'plone_view = bobtemplates.plone.bobregistry:plone_view','plone_viewlet = bobtemplates.plone.bobregistry:plone_viewlet','plone_portlet = bobtemplates.plone.bobregistry:plone_portlet','plone_theme = bobtemplates.plone.bobregistry:plone_theme','plone_theme_barceloneta = bobtemplates.plone.bobregistry:plone_theme_barceloneta',# NOQA E501'plone_vocabulary = bobtemplates.plone.bobregistry:plone_vocabulary',# NOQA E501'plone_behavior = bobtemplates.plone.bobregistry:plone_behavior',# NOQA E501'plone_restapi_service = bobtemplates.plone.bobregistry:plone_restapi_service',# NOQA E501],},The entry_point name is used as the global template name for mr.bob.You also need to provide a bobregistry.py file with a method for each entry_point, it should be named after the entry_point name:# -*- coding: utf-8 -*-classRegEntry(object):def__init__(self):self.template=''self.plonecli_alias=''self.depend_on=Noneself.deprecated=Falseself.info=''# standalone templatedefplone_addon():reg=RegEntry()reg.template='bobtemplates.plone:addon'reg.plonecli_alias='addon'returnreg# sub templatedefplone_theme():reg=RegEntry()reg.template='bobtemplates.plone:theme'reg.plonecli_alias='theme'reg.depend_on='plone_addon'returnregFor 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 ploneclidepend_on:for a standalone template, the depend_on property is Nonefor a sub template, the depend_on contains the name of the parent standalone template, usualyaddon.deprecated- boolean saying whether this templates is deprecated and will be removed in future releasesinfo- message that will be shown next to the template when the template is deprecatedContributeIssue Tracker:https://github.com/plone/plonecli/issuesSource Code:https://github.com/plone/plonecliLicenseThis project is licensed under the BSD license.History2.5 (2022-11-03)Provide a way to pass a mrbob configuration file
[erral]2.4 (2022-10-10)Depend on bobtemplates.plone >=6.0b15 ;)2.3 (2022-10-08)Depend on bobtemplates.plone >=6.0b162.2 (2022-05-04)Remove dependency onvirtualenv.
[wesleybl]Rename deprecatedautocompletionparameter toshell_complete[zshashz]2.1.2 (2021-05-06)Fix broken releases 2.1/2.1.1
[MrTango]2.1.1 (2021-05-05)Fix setup.cfg - v2.1 is a brown bag release.
[jensens]Improve README
[svx]2.1 (2021-05-05)Call mr.bob using its API, no longer as subprocess.
This ease the usage in a virtualenv.
[jensens]Do not install zest.releaser with plonecli (keep for dev/tox).
[jensens]Do not install virtualenv if not Python 2.7
[jensens]2.0 (2020-12-10)Release2.0b1 (2020-11-20)Add alias upport and an alias for “virtualenv” for the venv command
[MrTango]Improve handling of global/local commands, we use ClickFilteredAliasedGroup to filter the command rather than using an if condition in code.
[MrTango]2.0a2 (2020-11-19)Fix #63 generate_mrbob_ini and the acconding tests
[MrTango]Drop Python2.7 support and remove it from tox and travis setup. Also improve linting with new isort and black.
[MrTango]Add config command to disable the venv creation/update on plonecli build command
[MrTango]Allow auto completion of template names
[MrTango]Improve mrbob config generation and now override an existing config file after a warning
[MrTango]Fix typos, ReST formatting and update content of README.rst.
[staeff]1.1 (2019-04-14)Add new build option -p to define the python binary to use for the virtualenv
[MrTango]1.0 (2019-03-08)add note for including install directory to $PATH
[fgrcon]Document the newdeprecatedandinfooptions
[erral]modernize code for Python 3 support
[MrTango]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 release0.1.1b2 (2018-03-22)Fix dist on pypi0.1.1b1 (2018-03-22)Add requirements.txt referencing the special Click version.
This makes apipinstallation 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]