Misc helper-scripts for creating and expanding Plone-Add-Ons.
Project description
Introduction
============
Yet another command-line Plone-Add-On-Generator.
This package doesn't have any dependencies, so all ever possible occuring
problems can safely be attributed to itself.
Additionally it was desirable to be able to execute any Plone-addon-extending
command of within any location of an addon. Or, of outside of an addon, by
prepending the path to the addon to the command, so one doesn't necessarily
need to change directories and executing a command doesn't require you to be in
a certain directory.
Besides of Plone-addon-related helper-functions, there are also functions more
general related to developing, like `doOnRemote()`, `getRepos()`,
`squash()`, and so on.
Setting up a new Plone-instance is as easy as `addPlone()`, will download the
configs for buildout locally and set buildout's mode to 'offline', so we save
time, whenever running buildout, because it will not look up the configs of
remote addresses, like usually, as time is honey.
DISCLAIMER: The usual formatting of Plone-configs have changed, addPlone() works
testedly up to Plone vs. 4.3.4, needs to be fixed for getting newer versions.
Installation
=============
Stable-version
--------------
Of the commandline execute::
pip install adi.devgen
Develop-version
---------------
Of the commandline execute::
pip install -e git+https://github.com/ida/adi.devgen.git#egg=adi.devgen
The latest state of this package will be added to a directory (a.k.a. folder)
called 'src', which lives, where your pip lives. To find out where your pip
lives, type `which pip` into your console. You can then change the code inside
of the src-directory and get the effects immediately.
Configuration / Presettings
===========================
When creating a new addon and a file '~/.buildout/devgen.cfg' is present,
values will be read of it and inserted into the `setup.py` of the addon.
The file-contents' format must be like this::
author=Arbi Trary
author_email=arbi@tra.ry
url=https://github.com/arbitrary/your.addon
Usage
=====
Type the command and 'help', to get a verbose description fo this tool::
devgen help
Type the command alone, to get a list of the available generator-functions::
devgen
Or, have a look into the methods of adi.devgen.scripts.skel.addSkel, all of
those are available of the commandline, when prepending 'devgen'.
To get a choosen function's help-text, to see what arguments it expects, type::
devgen [FUNCTION_NAME] help
Examples
========
Create boilerplate for an addon, that can do nothing, but be installed in a Plonesite::
devgen addProfile your.addon
Create it not in the directory, where you are, but somewhere else::
devgen addProfile some/where/else/your.addon
Register another addon as a dependency to your addon::
devgen addDep collective.bestaddonever some/where/your.addon
Or, first locate into your addon, then you can omit the appended path::
cd your.addon
devgen addDep collective.bestaddonever
By the way, most commands work of within any location inside of an addon
and no need to pass a path.
Register and add a browser-based stylesheet named 'main.css' in
'your.addon/your/addon/browser/resources'::
devgen addCss
Register and add a browser-based Javascript named 'magic.js' in
'your.addon/your/addon/browser/resources'::
devgen addJS magic
Register and add a browser-based Template named 'main.pt' and a
Python-script named 'main.py' with an example how to retrieve a
computed value of the script in the template via TAL, in:
'your.addon/your/addon/browser/resources'::
devgen addView
The view can then be called in a browser like this::
http://localhost:8080/Plone/++resource++your.addon.resources/your_addon_main_view
Where 'main' is the default name for the files, you can choose any other::
devgen addView any_other
That'll result to::
http://localhost:8080/Plone/++resource++your.addon.resources/your_addon_any_other_view
TODO
====
- Regard more than one-dotted-namespace for addon.
- Possibly transfer:
https://github.com/ida/skriptz/blob/master/plone/Dexterity/addField.py
Changelog
=========
1.3 (2017-05-11)
----------------
- Improve addPlone() and deploy(). [ida]
- Add isView() and improve idExists-methods. [ida]
- Add getChildPosInParent() and getChildPosInParents() [ida]
1.2 (2016-10-21)
----------------
- Add workflow-related helper-methods. [ida]
1.1 (2016-07-10)
----------------
- Last release was a brown bag, pardon.
- Add addNChildrenRecursive(), delDep(), deploy(), getField(), getFields(),
getUserId(),
- Fix skin-path name, so templates get immediately callable after added to product.
- Fix isIniInstall() in addInstallScript().
- Improve addInstallScript()
- Regard if browser-skel is missing in addView().
- Show complete name, not just first name in quickinstaller.
- Add eggtractor, add develop-section in default-buildout-conf,
increase default plone-vs.
1.0 (2016-05-14)
----------------
- Add doOnRemote(), squash() and getUnpushedCommits().
- Fix "cannot find virtenv" in addPlone().
- Re-add default-filename "main" for generating stylesheet, Javascript,
Python-script and a template via addOn().
- Fix, if browserlayer is missing in addCss() and addJs().
0.9 (2015-11-18)
----------------
- Add addView().
- Add default-values of a function's expected arguments to help-msg.
- Fix path: Use dot instead of slash, for a resources' paths in
js-registry-generation.
- Let getAddonPath() fail with an exit, to prevent further
code-executions.
- Rename addBrowserSkel() to addBrowser(), addSkinSkel() to addSkin,
and so on, for less typing.
- Fix addBrowser() and addSkin() from scratch – if not added on top of existing
addon.
- Improve addAndRegisterView().
0.8 (151002)
------------
- Generate missing browser-slug in config.
- Change docs from MD-format to RST, as pypi requires.
- Add addCss() and addJs().
0.7 (150926)
------------
- Fix missing import and typo in setup.py-generation, which broke addons-installs.
0.6 (150923)
------------
- Update README, improve installPlone().
0.5 (150921)
------------
- Fix imports, better hlp-msgs, improve installPlone().
0.4 (150920)
------------
- Update README
0.3 (150920)
------------
- Fix changed import-paths.
0.2 (150920)
------------
- Add adi.commons as dependency.
0.1 (150920)
------------
- Initial release
============
Yet another command-line Plone-Add-On-Generator.
This package doesn't have any dependencies, so all ever possible occuring
problems can safely be attributed to itself.
Additionally it was desirable to be able to execute any Plone-addon-extending
command of within any location of an addon. Or, of outside of an addon, by
prepending the path to the addon to the command, so one doesn't necessarily
need to change directories and executing a command doesn't require you to be in
a certain directory.
Besides of Plone-addon-related helper-functions, there are also functions more
general related to developing, like `doOnRemote()`, `getRepos()`,
`squash()`, and so on.
Setting up a new Plone-instance is as easy as `addPlone()`, will download the
configs for buildout locally and set buildout's mode to 'offline', so we save
time, whenever running buildout, because it will not look up the configs of
remote addresses, like usually, as time is honey.
DISCLAIMER: The usual formatting of Plone-configs have changed, addPlone() works
testedly up to Plone vs. 4.3.4, needs to be fixed for getting newer versions.
Installation
=============
Stable-version
--------------
Of the commandline execute::
pip install adi.devgen
Develop-version
---------------
Of the commandline execute::
pip install -e git+https://github.com/ida/adi.devgen.git#egg=adi.devgen
The latest state of this package will be added to a directory (a.k.a. folder)
called 'src', which lives, where your pip lives. To find out where your pip
lives, type `which pip` into your console. You can then change the code inside
of the src-directory and get the effects immediately.
Configuration / Presettings
===========================
When creating a new addon and a file '~/.buildout/devgen.cfg' is present,
values will be read of it and inserted into the `setup.py` of the addon.
The file-contents' format must be like this::
author=Arbi Trary
author_email=arbi@tra.ry
url=https://github.com/arbitrary/your.addon
Usage
=====
Type the command and 'help', to get a verbose description fo this tool::
devgen help
Type the command alone, to get a list of the available generator-functions::
devgen
Or, have a look into the methods of adi.devgen.scripts.skel.addSkel, all of
those are available of the commandline, when prepending 'devgen'.
To get a choosen function's help-text, to see what arguments it expects, type::
devgen [FUNCTION_NAME] help
Examples
========
Create boilerplate for an addon, that can do nothing, but be installed in a Plonesite::
devgen addProfile your.addon
Create it not in the directory, where you are, but somewhere else::
devgen addProfile some/where/else/your.addon
Register another addon as a dependency to your addon::
devgen addDep collective.bestaddonever some/where/your.addon
Or, first locate into your addon, then you can omit the appended path::
cd your.addon
devgen addDep collective.bestaddonever
By the way, most commands work of within any location inside of an addon
and no need to pass a path.
Register and add a browser-based stylesheet named 'main.css' in
'your.addon/your/addon/browser/resources'::
devgen addCss
Register and add a browser-based Javascript named 'magic.js' in
'your.addon/your/addon/browser/resources'::
devgen addJS magic
Register and add a browser-based Template named 'main.pt' and a
Python-script named 'main.py' with an example how to retrieve a
computed value of the script in the template via TAL, in:
'your.addon/your/addon/browser/resources'::
devgen addView
The view can then be called in a browser like this::
http://localhost:8080/Plone/++resource++your.addon.resources/your_addon_main_view
Where 'main' is the default name for the files, you can choose any other::
devgen addView any_other
That'll result to::
http://localhost:8080/Plone/++resource++your.addon.resources/your_addon_any_other_view
TODO
====
- Regard more than one-dotted-namespace for addon.
- Possibly transfer:
https://github.com/ida/skriptz/blob/master/plone/Dexterity/addField.py
Changelog
=========
1.3 (2017-05-11)
----------------
- Improve addPlone() and deploy(). [ida]
- Add isView() and improve idExists-methods. [ida]
- Add getChildPosInParent() and getChildPosInParents() [ida]
1.2 (2016-10-21)
----------------
- Add workflow-related helper-methods. [ida]
1.1 (2016-07-10)
----------------
- Last release was a brown bag, pardon.
- Add addNChildrenRecursive(), delDep(), deploy(), getField(), getFields(),
getUserId(),
- Fix skin-path name, so templates get immediately callable after added to product.
- Fix isIniInstall() in addInstallScript().
- Improve addInstallScript()
- Regard if browser-skel is missing in addView().
- Show complete name, not just first name in quickinstaller.
- Add eggtractor, add develop-section in default-buildout-conf,
increase default plone-vs.
1.0 (2016-05-14)
----------------
- Add doOnRemote(), squash() and getUnpushedCommits().
- Fix "cannot find virtenv" in addPlone().
- Re-add default-filename "main" for generating stylesheet, Javascript,
Python-script and a template via addOn().
- Fix, if browserlayer is missing in addCss() and addJs().
0.9 (2015-11-18)
----------------
- Add addView().
- Add default-values of a function's expected arguments to help-msg.
- Fix path: Use dot instead of slash, for a resources' paths in
js-registry-generation.
- Let getAddonPath() fail with an exit, to prevent further
code-executions.
- Rename addBrowserSkel() to addBrowser(), addSkinSkel() to addSkin,
and so on, for less typing.
- Fix addBrowser() and addSkin() from scratch – if not added on top of existing
addon.
- Improve addAndRegisterView().
0.8 (151002)
------------
- Generate missing browser-slug in config.
- Change docs from MD-format to RST, as pypi requires.
- Add addCss() and addJs().
0.7 (150926)
------------
- Fix missing import and typo in setup.py-generation, which broke addons-installs.
0.6 (150923)
------------
- Update README, improve installPlone().
0.5 (150921)
------------
- Fix imports, better hlp-msgs, improve installPlone().
0.4 (150920)
------------
- Update README
0.3 (150920)
------------
- Fix changed import-paths.
0.2 (150920)
------------
- Add adi.commons as dependency.
0.1 (150920)
------------
- Initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
adi.devgen-1.3.tar.gz
(34.7 kB
view hashes)
Built Distribution
adi.devgen-1.3-py2.7.egg
(65.2 kB
view hashes)