views:

47

answers:

2

I want to automate the process of plone3_buildout.

Explanation: The default(the one I use) way of building a plone site is using paster, like so:

paster create -t plone3_buildout

This asks me a few questions and then create a default buildout for the site.

What I want: I want to automate this process using buildout. My buildout will execute this paster command, feed in my preconfigured values to the paster.

I haven't found a recipe which can do this. If someone has an idea of how to do this, please share the info.

If there is a recipe which can feed values to interactive commands(with known output, like with plone3_buildout command), that would be useful too.

+1  A: 

There is a utility called "expect" which is designed for automating interactive command line operations.

http://expect.nist.gov

Another approach would be to modify or clone-and-customize the plone3_buildout script and template in the ZopeSkel package.

However at that point, if you're hardcoding all the variables, you might as well create the buildout once, put in into version control, and copy/clone it to make new instances.

siebo
ya, that is one way to do it. I used pexpect. Then I wanted to write a buildout recipe for automating the process. That's a work in progress for now.
roopesh
+1  A: 

The paster create command can accept a --config option. This allows you to generate or use a file with answers to the questions.

$ paster create -t plone3_buildout --config=saved.cfg my-buildout
...
answer questions
...

Now there will be a buildout.config file in the current directory.

$ cat saved.cfg
[pastescript]
eggifiedplone__eval__ = True
zope_user = admin
expert_mode = all
zope2_install = 
plone_products_install = 
tarballs__eval__ = False
egg_plugins__eval__ = []
plone_version = 3.3.4
debug_mode = off
plus = +
dot = .
zope_password = 
http_port__eval__ = 8080
egg = test_buildout
z29tarballs__eval__ = False
eggifiedzope__eval__ = False
verbose_security = off

You can modify this file and run paster with the same command.

$ paster create -t plone3_buildout --config=saved.cfg my-new-buildout

This time it won't ask you any questions. All of the answers will come from the config file. The latest ZopeSkel (2.15+) also has a way to store these settings in $HOME/.zopeskel.

claytron
Thanks for this solution. I tried it with a pylons project, and it works great, I will try it on plone project soon. I would still like to make a recipe out of this step of project creation.
roopesh