Skip to content

Commit

Permalink
Clearer documentation about witch template we should use
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Jun 20, 2018
1 parent b24aa94 commit 2fa51f7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 24 deletions.
45 changes: 31 additions & 14 deletions doc/integrator/create_application.rst.mako
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Create a new application
========================

Creating a new c2cgeoportal application is done by applying two Paste skeletons
(a.k.a. templates and scaffolds). These skeletons are provided by the
Creating a new c2cgeoportal application is done by applying two Paste scaffolds
(a.k.a. templates and scaffolds). These scaffolds are provided by the
``c2cgeoportal`` package. So to be able to create a c2cgeoportal application
the ``c2cgeoportal`` package must be installed.

Expand All @@ -15,17 +15,17 @@ that is already alongside the existing c2cgeoportal application.

.. note::

Some c2cgeoportal applications provide their own skeletons. For example
a *parent* application may provide a skeleton for creating *child*
applications. In that case, the c2cgeoportal skeletons, as well as the
application skeletons, should be applied.
Some c2cgeoportal applications provide their own scaffolds. For example
a *parent* application may provide a scaffold for creating *child*
applications. In that case, the c2cgeoportal scaffolds, as well as the
application scaffolds, should be applied.

Project structure
-----------------

In the simple case the root directory of the application is the directory
created by the c2cgeoportal skeletons (the ``c2cgeoportal_create`` and
``c2cgeoportal_update`` skeletons).
created by the c2cgeoportal scaffolds (the ``c2cgeoportal_create`` and
``c2cgeoportal_update`` scaffolds).

Install c2cgeoportal
--------------------
Expand All @@ -49,10 +49,10 @@ To get ``c2cgeoportal`` you first need to get the related docker image:
wget https://raw.githubusercontent.com/camptocamp/c2cgeoportal/${git_branch}/docker-run
chmod +x docker-run

List existing skeletons
List existing scaffolds
-----------------------

To list the available skeletons/templates use the following command, either
To list the available scaffolds use the following command, either
from the root directory of c2cgeoportal (if you have followed the instructions
from the previous section), or from the root directory of the existing
c2cgeoportal application you want to create the new application from:
Expand All @@ -61,9 +61,11 @@ c2cgeoportal application you want to create the new application from:

./docker-run --image=camptocamp/geomapfish-build pcreate -l

You should at least see the c2cgeoportal skeletons:
You should at least see the c2cgeoportal scaffolds:

* c2cgeoportal_create
* c2cgeoportal_nondockercreate
* c2cgeoportal_nondockerupdate
* c2cgeoportal_update

Create the new application
Expand All @@ -77,13 +79,20 @@ Normally the project name should be the same name as the Git repository name.
The package name should not contain an underscore (``_``) because of an
issue with Pip.

To create the application first apply the ``c2cgeoportal_create`` skeleton:
To create the application first apply the ``c2cgeoportal_create`` scaffold:

.. prompt:: bash

./docker-run -ti --image=camptocamp/geomapfish-build \
pcreate -s c2cgeoportal_create <project>

And for the non Docker version, apply also the ``c2cgeoportal_nondockercreate`` scaffold:

.. prompt:: bash

./docker-run -ti --image=camptocamp/geomapfish-build \
pcreate -s c2cgeoportal_nondockercreate <project>

.. note::

Do not add any '/' after the project name.
Expand All @@ -107,19 +116,27 @@ This will create a directory named ``<project>`` that will be next to the
``c2cgeoportal`` directory, or to the directory of the application you are
creating this application from.

Now apply the ``c2cgeoportal_update`` skeleton:
Now apply the ``c2cgeoportal_update`` scaffold:

.. prompt:: bash

./docker-run -ti --env=SRID=21781 --image=camptocamp/geomapfish-build \
pcreate -s c2cgeoportal_update --package-name <package> <project>

And for the non Docker version, apply also the ``c2cgeoportal_nondockerupdate`` scaffold:

.. prompt:: bash

./docker-run -ti --env=SRID=21781 --image=camptocamp/geomapfish-build \
pcreate -s c2cgeoportal_nondockerupdate --package-name <package> <project>


.. note::

Do not add any '/' after the project name.

The ``c2cgeoportal_update`` scaffold is also used to update the
application. The files generated by this skeleton are prefixed with
application. The files generated by this scaffold are prefixed with
``CONST_``, which means they are *constant* files that should not be changed.
Following this rule is important for easier updates.

Expand Down
10 changes: 0 additions & 10 deletions geoportal/c2cgeoportal_geoportal/scaffolds/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@

from pyramid.scaffolds.template import Template
from pyramid.compat import input_
from c2cgeoportal_geoportal.lib.bashcolor import colorize, GREEN


class BaseTemplate(Template): # pragma: no cover
Expand Down Expand Up @@ -170,13 +169,6 @@ def post(self, command, output_dir, vars_):

fix_executables(output_dir, ("docker-run", "docker-compose-run", "bin/*"))

self.out("\nContinue with:")
self.out(colorize(
"SRID={vars[srid]} EXTENT={vars[extent]} ./docker-run pcreate --scaffold c2cgeoportal_update "
"--ignore-conflicting-name --package-name {vars[package]} ../{vars[project]}".format(vars=vars_),
GREEN
))

return BaseTemplate.post(self, command, output_dir, vars_)


Expand Down Expand Up @@ -208,8 +200,6 @@ def post(self, command, output_dir, vars_):

fix_executables(output_dir, ("docker-run", "docker-compose-run", "bin/*"), True)

self.out(colorize("\nWelcome to c2cgeoportal!", GREEN))

return BaseTemplate.post(self, command, output_dir, vars_)


Expand Down

0 comments on commit 2fa51f7

Please sign in to comment.