[Usuarios Plone] poniendo huevos
Mikel Larreategi
mlarreategi at codesyntax.com
Fri Feb 13 07:12:45 UTC 2009
Héctor Velarde(e)k dio:
> me he comprometido, ante el grupo de usuarios de mi pueblo, a dictar un
> tallercito en el que explique las bases para crear un producto de Plone.
> como mis conocimientos se quedaron estancados en Plone 2.5, necesito
> actualizarme un poquito:
>
> ¿cómo convierto un producto de los de antes a un huevo?
>
> un viejo amigo de Mikel ;-) me ha dicho algo así como "Product namespace
> package"... yo he gugleado y he encontrado esto:
> http://plone.org/documentation/tutorial/buildout/packages-products-and-eggs
>
> aparentemente solo uso ZopeSkel y... voilà, he puesto un huevo (Mikel
> dixit)... pero yo sigo teniendo mis dudas... ¿necesito hacer algo más?
> ¿meto mi viejo código ahí y listo? ¿cómo hago el desarrollo? ¿cómo
> convierto esa estructura a un huevo?
>
> ¿me ayudan?
>
Por supuesto !!!
Vamos a poner un ejemplo que conoces, pongamos un huevo de ATGoogleVideo:
1- Hacemos un export del trunk de ATGoogleVideo:
erral at lindari:/tmp$ svn export
https://svn.plone.org/svn/collective/ATGoogleVideo/trunk ATGoogleVideo-trunk
2- Creemos la estructura del huevo usando paster:
erral at lindari:/tmp$ paster create -t plone Products.ATGoogleVideo
Selected and implied templates:
ZopeSkel#basic_namespace A project with a namespace package
ZopeSkel#plone A Plone project
Variables:
egg: Products.ATGoogleVideo
package: productsatgooglevideo
project: Products.ATGoogleVideo
Enter namespace_package (Namespace package (like plone)) ['plone']: Products
Enter package (The package contained namespace package (like example))
['example']: ATGoogleVideo
Enter zope2product (Are you creating a Zope 2 Product?) [False]: True
Enter version (Version) ['1.0']: 1.0
Enter description (One-line description of the package) ['']:
Enter long_description (Multi-line description (in reST)) ['']:
Enter author (Author name) ['Plone Foundation']:
Enter author_email (Author email)
['plone-developers at lists.sourceforge.net']:
Enter keywords (Space-separated keywords/tags) ['']:
Enter url (URL of homepage)
['http://svn.plone.org/svn/plone/plone.example']:
Enter license_name (License name) ['GPL']:
Enter zip_safe (True/False: if the package can be distributed as a .zip
file) [False]:
Creating template basic_namespace
Creating directory ./Products.ATGoogleVideo
Recursing into +namespace_package+
Creating ./Products.ATGoogleVideo/Products/
Recursing into +package+
Creating ./Products.ATGoogleVideo/Products/ATGoogleVideo/
Copying __init__.py_tmpl to
./Products.ATGoogleVideo/Products/ATGoogleVideo/__init__.py
Copying __init__.py_tmpl to
./Products.ATGoogleVideo/Products/__init__.py
Copying README.txt_tmpl to ./Products.ATGoogleVideo/README.txt
Recursing into docs
Creating ./Products.ATGoogleVideo/docs/
Copying HISTORY.txt_tmpl to ./Products.ATGoogleVideo/docs/HISTORY.txt
Copying setup.cfg to ./Products.ATGoogleVideo/setup.cfg
Copying setup.py_tmpl to ./Products.ATGoogleVideo/setup.py
Creating template plone
Recursing into +namespace_package+
Recursing into +package+
Replace 0 bytes with 86 bytes (0/0 lines changed; 3 lines added)
Copying __init__.py_tmpl to
./Products.ATGoogleVideo/Products/ATGoogleVideo/__init__.py
Copying configure.zcml_tmpl to
./Products.ATGoogleVideo/Products/ATGoogleVideo/configure.zcml
Copying tests.py_tmpl to
./Products.ATGoogleVideo/Products/ATGoogleVideo/tests.py
Recursing into docs
Copying INSTALL.txt_tmpl to ./Products.ATGoogleVideo/docs/INSTALL.txt
Copying LICENSE.GPL to ./Products.ATGoogleVideo/docs/LICENSE.GPL
Copying LICENSE.txt_tmpl to ./Products.ATGoogleVideo/docs/LICENSE.txt
Replace 1022 bytes with 1272 bytes (0/32 lines changed; 8 lines added)
Copying setup.py_tmpl to ./Products.ATGoogleVideo/setup.py
------------------------------------------------------------------------------
The project you just created has local commands. These can be used from
within
the product.
usage: paster COMMAND
Commands:
addcontent Adds plone content types to your project
For more information: paster help COMMAND
------------------------------------------------------------------------------
Running /usr/bin/python2.4 setup.py egg_info
erral at lindari:/tmp$
erral at lindari:/tmp$ ls -l Products.ATGoogleVideo/
guztira 24
drwxr-xr-x 2 erral erral 4096 2009-02-13 08:08 docs
drwxr-xr-x 3 erral erral 4096 2009-02-13 08:08 Products
drwxr-xr-x 2 erral erral 4096 2009-02-13 08:08
Products.ATGoogleVideo.egg-info
-rw-r--r-- 1 erral erral 28 2009-02-13 08:08 README.txt
-rw-r--r-- 1 erral erral 81 2009-02-13 08:08 setup.cfg
-rw-r--r-- 1 erral erral 1272 2009-02-13 08:08 setup.py
3- Ahora nos colocamos dentro del directorio
Products.ATGoogleVideo/Products/ATGoogleVideo y copiamos el contenido de
lo exportado en el paso 1:
erral at lindari:/tmp$ cd Products.ATGoogleVideo/Products/ATGoogleVideo/
erral at lindari:/tmp/Products.ATGoogleVideo/Products/ATGoogleVideo$ cp -R
/tmp/ATGoogleVideo-trunk/* .
Y voila, tenemos un huevo recién puesto :P
Pero nuestro huevo tiene una yema extra si lo miramos bien. Si en el
primer paso ponemos
--svn-repository=https://svn.plone.org/svn/collective paster se
encargará de crear la estructura necesaria en el SVN (con su trunk,
branches y tags) y subirá ahí nuestros archivos y sólo tendríamos que
hacer un svn commit como paso 4 para tenerlo todo en SVN.
Pero aún hay más, seguramente en vez de hacer un svn export y luego un
commit con el código del producto, se podría hacer un svn cp entre uno y
otro y mantendríamos el histórico de revisiones. Pero es una cosa que no
he probado demasiado y que a veces me ha creado errores (no soy un Jadi
del SVN :P).
Suerte,
Mikel
--
Mikel Larreategi
mlarreategi at codesyntax.com
CodeSyntax
Azitaingo Industrialdea 3 K
E-20600 Eibar
Tel: (+34) 943 82 17 80
More information about the Usuarios-Plone
mailing list