Skip to content

Commit

Permalink
Merge pull request #4340 from camptocamp/merge23
Browse files Browse the repository at this point in the history
 Merge remote-tracking branch 'origin/2.3'
  • Loading branch information
sbrunner committed Nov 23, 2018
2 parents d7ee4a9 + 0b32a63 commit 8a5721a
Show file tree
Hide file tree
Showing 37 changed files with 328 additions and 174 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ install:

before_script:
- docker build --tag=camptocamp/geomapfish-build-dev:${MAJOR_VERSION} docker/build
- ./docker-run --env=TRAVIS_TAG make build
- ./docker-run make build

## FOR NON DOCKER TESTS
- deactivate
Expand All @@ -61,8 +61,6 @@ before_script:
- docker build --tag=external-db docker/test-external-db
- docker run --publish=5433:5432 --detach external-db
- mkdir /tmp/travis
- 'if [ "${TRAVIS_TAG}" != "" ]; then docker tag camptocamp/geomapfish-build:${MAJOR_VERSION}
camptocamp/geomapfish-build:${TRAVIS_TAG}; fi'
- travis/create-new-nondocker-project.sh
- (cd /tmp/travis/nondockertestgeomapfish/; ./docker-run travis/empty-make --makefile=travis.mk help)
- (cd /tmp/travis/nondockertestgeomapfish/; ./docker-run make --makefile=travis.mk build)
Expand Down
29 changes: 25 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ def clean() {
def abort_ci() {
// Makes sure Jenkins will not build his own commit
COMMITTER = sh(returnStdout: true, script: "git show --no-patch --format='%ae' HEAD").trim()
if (COMMITTER == 'ci@camptocamp.com') {
TAG = sh(returnStdout: true, script: 'git tag --list --points-at=HEAD').trim()
USER_START = currentBuild.getBuildCauses()[0].get('shortDescription').startsWith('Started by user ')
if (COMMITTER == 'ci@camptocamp.com' && TAG == "" && !USER_START) {
// Return here instead of throwing error to keep the build "green"
currentBuild.result = 'SUCCESS'
return true
Expand All @@ -42,26 +44,45 @@ dockerBuild {
try {
stage('Clean') {
checkout scm
if (abort_ci()) { return }
sh 'docker --version'
sh 'docker-compose --version'
clean()
}
stage('Build') {
if (abort_ci()) { return }
sh 'git config user.email ci@camptocamp.com'
sh 'git config user.name CI'
sh 'git branch --delete --force ${BRANCH_NAME} || true'
sh 'git checkout -b ${BRANCH_NAME}'
sh 'git remote set-url origin git@github.com:camptocamp/c2cgeoportal.git'
sshagent (credentials: ['c2c-infra-ci']) {
sh 'git fetch --tags'
}

if (abort_ci()) { return }

sh 'python3 -m venv .venv'
sh '.venv/bin/python .venv/bin/pip install --requirement=travis/requirements.txt'

TAG = sh(returnStdout: true, script: 'git tag --list --points-at=HEAD').trim()
LAST_TAG = sh(returnStdout: true, script: 'git describe --abbrev=0 --tags').trim()
RELEASE_TAG = MAJOR_VERSION
if (TAG =~ /^[0-9]\.[0-9]\.[0-9]$/) {
RELEASE_TAG = TAG
}
else {
if (BRANCH_NAME =~ /^[0-9]\.[0-9]$/) {
MINOR = sh(returnStdout: true, script: '.venv/bin/python travis/get-minor --no-save').trim()
RELEASE_TAG = "${LAST_TAG}.${MINOR}"
}
}
env.RELEASE_TAG = RELEASE_TAG

sh 'make docker-build'
sh 'docker run --name geomapfish-db --env=POSTGRES_USER=www-data --env=POSTGRES_PASSWORD=www-data --env=POSTGRES_DB=geomapfish --publish=5432:5432 --detach camptocamp/geomapfish-test-db'
sh './docker-run travis/status.sh'
sh './docker-run travis/short-make build'
sh './docker-run --env=RELEASE_TAG travis/short-make build'
sh "docker tag camptocamp/geomapfish-build:${MAJOR_VERSION} camptocamp/geomapfish-build:${RELEASE_TAG}"
sh 'travis/test-upgrade-convert.sh init ${HOME}/workspace'
}
stage('Tests') {
if (abort_ci()) { return }
Expand Down
16 changes: 12 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
BUILD_DIR ?= /build
MAKO_FILES = docker-compose.yaml.mako $(shell find .tx doc docker geoportal/tests/functional -type f -name "*.mako" -print)
MAKO_FILES = Dockerfile.mako docker-compose.yaml.mako $(shell find .tx doc docker geoportal/tests/functional -type f -name "*.mako" -print)
VARS_FILE ?= vars.yaml
VARS_FILES += vars.yaml

Expand All @@ -16,8 +16,8 @@ endif

export MAJOR_VERSION = 2.4
export MAIN_BRANCH = master
ifdef TRAVIS_TAG
export VERSION = $(TRAVIS_TAG)
ifdef RELEASE_TAG
export VERSION = $(RELEASE_TAG)
else
export VERSION = $(MAJOR_VERSION)
endif
Expand Down Expand Up @@ -105,7 +105,7 @@ help:
docker-build:
for image in `find -name Dockerfile -o -name Dockerfile.mako | xargs grep --no-filename FROM | awk '{print $$2}' | sort -u`; do docker pull $$image; done
docker build --tag=camptocamp/geomapfish-build-dev:${MAJOR_VERSION} docker/build
./docker-run make build
./docker-run --env=RELEASE_TAG make build

.PHONY: build
build: \
Expand Down Expand Up @@ -293,6 +293,9 @@ spell:

YAML_FILES ?= $(shell find \
-name node_modules -prune -or \
-name .git -prune -or \
-name .venv -prune -or \
-name .mypy_cache -prune -or \
-name functional -prune -or \
\( -name "*.yml" -or -name "*.yaml" \) -print)
.PHONY: yamllint
Expand Down Expand Up @@ -492,27 +495,31 @@ geoportal/c2cgeoportal_geoportal/locale/%/LC_MESSAGES/c2cgeoportal_geoportal.po:
$(PRERULE_CMD)
mkdir --parent $(dir $@)
tx pull --language $* --resource geomapfish.c2cgeoportal_geoportal-$(TX_VERSION) --force
sed -i 's/[[:space:]]\+$///' $@
$(TOUCHBACK_TXRC)
test -s $@

geoportal/c2cgeoportal_geoportal/locale/%/LC_MESSAGES/ngeo.po: $(TX_DEPENDENCIES)
$(PRERULE_CMD)
mkdir --parent $(dir $@)
tx pull --language $* --resource ngeo.ngeo-$(TX_VERSION) --force
sed -i 's/[[:space:]]\+$///' $@
$(TOUCHBACK_TXRC)
test -s $@

geoportal/c2cgeoportal_geoportal/locale/%/LC_MESSAGES/gmf.po: $(TX_DEPENDENCIES)
$(PRERULE_CMD)
mkdir --parent $(dir $@)
tx pull --language $* --resource ngeo.gmf-$(TX_VERSION) --force
sed -i 's/[[:space:]]\+$///' $@
$(TOUCHBACK_TXRC)
test -s $@

admin/c2cgeoportal_admin/locale/%/LC_MESSAGES/c2cgeoportal_admin.po: $(TX_DEPENDENCIES)
$(PRERULE_CMD)
mkdir --parent $(dir $@)
tx pull --language $* --resource geomapfish.c2cgeoportal_admin-$(TX_VERSION) --force
sed -i 's/[[:space:]]\+$///' $@
$(TOUCHBACK_TXRC)
test -s $@

Expand All @@ -521,6 +528,7 @@ geoportal/c2cgeoportal_geoportal/scaffolds/create/geoportal/+package+_geoportal/
$(PRERULE_CMD)
mkdir --parent $(dir $@)
tx pull --language $* --resource ngeo.gmf-apps-$(TX_VERSION) --force
sed -i 's/[[:space:]]\+$///' $@
$(TOUCHBACK_TXRC)
test -s $@

Expand Down
21 changes: 14 additions & 7 deletions doc/developer/build_release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Before doing a release you should merge all the previous branch on this one:
ngeo
----

`For ngeo see here <https://github.com/camptocamp/ngeo/blob/master/docs/developer-guide.md#create-a-package-on-npm>_`.
`For ngeo see here <https://github.com/camptocamp/ngeo/blob/master/docs/developer-guide.md#create-a-package-on-npm>`_.

c2cgeoportal
------------
Expand Down Expand Up @@ -153,6 +153,13 @@ Tag the new release:
git tag <release>
git push origin <release>

Run a new job for the <version> branch on Jenkins.

.. note::

It's possible to do a version only on the latest commit on a branch,
If you relay need to do that, you should create a new branch.

Notes about Travis
~~~~~~~~~~~~~~~~~~

Expand All @@ -175,12 +182,12 @@ See :ref:`developer_build_release_pre_release_task` for more information.
For non dev release
-------------------

* Rename the milestone on `c2cgeoportal <https://github.com/camptocamp/c2cgeoportal/milestones>_`
and on `ngeo <https://github.com/camptocamp/ngeo/milestones>_` from ``x.y`` to ``x.y.z``.
* Create again the milestone on `c2cgeoportal <https://github.com/camptocamp/c2cgeoportal/milestones>_`
and on `ngeo <https://github.com/camptocamp/ngeo/milestones>_` for ``x.y``.
* Rename the milestone on `c2cgeoportal <https://github.com/camptocamp/c2cgeoportal/milestones>`_
and on `ngeo <https://github.com/camptocamp/ngeo/milestones>`_ from ``x.y`` to ``x.y.z``.
* Create again the milestone on `c2cgeoportal <https://github.com/camptocamp/c2cgeoportal/milestones>`_
and on `ngeo <https://github.com/camptocamp/ngeo/milestones>`_ for ``x.y``.
* Move all the open issues to the new milestone and close the current milestone
in `ngeo <https://github.com/camptocamp/ngeo/milestones>_`
and in `c2cgeoportal <https://github.com/camptocamp/c2cgeoportal/milestones>_`.
in `ngeo <https://github.com/camptocamp/ngeo/milestones>`_
and in `c2cgeoportal <https://github.com/camptocamp/c2cgeoportal/milestones>`_.
* Send a release email to the ``geomapfish@googlegroups.com``
and ``gmf2@lists.camptocamp.com`` mailing lists.
35 changes: 35 additions & 0 deletions doc/developer/debugging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,41 @@ Run:

Open the application with on the following path: ``https://<host>/<entry_point>/dev/<interface>.html``.

Use a specific version of ngeo
------------------------------

Clone ngeo and build:

.. prompt:: bash

cd geoportal
git clone https://github.com/camptocamp/ngeo.git
cd ngeo
git check <branch>
npm install
npm prepublish
cd ../..

Add the following alias in your ``webpack.apps.js.mako`` file:

.. code:: js
resolve: {
alias: {
<package>: ...,
+ ngeo: path.resolve(__dirname, 'ngeo/src'),
+ gmf: path.resolve(__dirname, 'ngeo/contribs/gmf/src'),
}
}
Force rebuild the application:

.. prompt:: bash

./docker-run rm /build/apps.<interface>.timestamp
./docker-run make build


Performance or network error
----------------------------

Expand Down
66 changes: 23 additions & 43 deletions doc/integrator/ngeo_new_interface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Adding a new user interface
---------------------------

This section describes how to add a new user interface to be named <interface>
(for example, "new") in a package named <package> (for example, "demo").
(for example, "new") in a package named ``<package>``.

Makefile
~~~~~~~~
Expand All @@ -17,82 +17,62 @@ For example, to have two NGEO interfaces called "mobile" and "new", set:
Copy files from template
~~~~~~~~~~~~~~~~~~~~~~~~
First, be sure you have all the required files from the templates; if not,
copy them as follows:

.. prompt:: bash

mkdir <package>/static-ngeo
cp -r CONST_create_template/<package>/static-ngeo/components <package>/static-ngeo/
cp -r CONST_create_template/<package>/static-ngeo/images <package>/static-ngeo/
mkdir <package>/static-ngeo/js
cp CONST_create_template/<package>/static-ngeo/js/<package>module.js <package>/static-ngeo/js/
mkdir <package>/static-ngeo/less
cp CONST_create_template/<package>/static-ngeo/less/<package>.less <package>/static-ngeo/less/
# Add all the new files to Git
git add <package>/static-ngeo

Then, if you want a new mobile interface, get the default files as follows:
If you want a new mobile interface, get the default files as follows:

.. prompt:: bash

cp CONST_create_template/<package>/templates/mobile.html <package>/templates/<interface>.html
cp CONST_create_template/<package>/static-ngeo/less/mobile.less <package>/static-ngeo/less/<interface>.less
cp CONST_create_template/<package>/static-ngeo/js/mobile.js <package>/static-ngeo/js/<interface>.js
cp CONST_create_template/geoportal/<package>_geoportal/static-ngeo/js/apps/mobile.html.ejs \
geoportal/<package>_geoportal/static-ngeo/js/apps/<interface>.html.ejs
cp CONST_create_template/geoportal/<package>_geoportal/static-ngeo/js/apps/Controllermobile.js \
geoportal/<package>_geoportal/static-ngeo/js/apps/Controller<interface>.js

If you want a new desktop interface, get the default files as follows:

.. prompt:: bash

cp CONST_create_template/<package>/templates/desktop.html <package>/templates/<interface>.html
cp CONST_create_template/<package>/static-ngeo/less/desktop.less <package>/static-ngeo/less/<interface>.less
cp CONST_create_template/<package>/static-ngeo/js/desktop.js <package>/static-ngeo/js/<interface>.js
cp CONST_create_template/geoportal/<package>_geoportal/static-ngeo/js/apps/desktop.html.ejs \
geoportal/<package>_geoportal/static-ngeo/js/apps/<interface>.html.ejs
cp CONST_create_template/geoportal/<package>_geoportal/static-ngeo/js/apps/Controllerdesktop.js \
geoportal/<package>_geoportal/static-ngeo/js/apps/Controller<interface>.js

Edit interface files
~~~~~~~~~~~~~~~~~~~~
In the file ``<package>/static-ngeo/js/<interface>.js``, adapt the following lines:
In the file ``geoportal/<package>_geoportal/static-ngeo/js/apps/Controller<interface>.js``,
adapt the following lines:

.. code:: js
* This file defines the "<package>_<interface>" Closure namespace, which is be used as
...
goog.provide('<package>.<Interface>Controller');
goog.provide('<package>_<interface>');
exports.module = angular.module('App<interface>', [
...
geoportal.<Interface>Controller = function($scope, $injector) {
exports.module.controller('<Interface>Controller', exports);
...
ol.inherits(<package>.<Interface>Controller, gmf.AbstractDesktopController);
...
geoportal.module.controller('<Interface>Controller', <package>.<Interface>Controller);
where ``<package>`` is the name of your package, and ``<interface>`` (desktop in the original file) is
the name of your new interface.
where ``<interface>`` (desktop in the original file) is the name of your new interface.
In the file ``<package/static-ngeo/templates/<interface>.html``, adapt the name of the controller and the
referenced css and js files to the new interface name:
In the file ``geoportal/<package>_geoportal/static-ngeo/static-ngeo/js/apps/<interface>.html.ejs``,
adapt the name of the controller and the referenced css and js files to the new interface name:
.. code:: html
<html lang="{{mainCtrl.lang}}" ng-app="<package>" ng-controller="<Interface>Controller as mainCtrl">
<link rel="stylesheet" href="${request.static_url('<package>:static-ngeo/build/<interface>.css')}" type="text/css">
...
goog.require('<package>_<interface>');
<html lang="{{mainCtrl.lang}}" ng-app="App<interface>" ng-controller="<Interface>Controller as mainCtrl">
...
'interface=<interface>&' +
...
<script src="${request.static_url('<package>:static-ngeo/build/<interface>.js')}"></script>
Add the new interface files to Git:
.. prompt:: bash
git add <package>/templates/<inferface>.html
git add <package>/templates/<inferface>.less
git add <package>/static-ngeo/js/<inferface>.js
git add geoportal/<package>_geoportal/static-ngeo/js/apps/<interface>.html.ejs
git add geoportal/<package>_geoportal/static-ngeo/js/apps/Controller<interface>.js
Package file
~~~~~~~~~~~~
Update the interface in your ``<package>/__init__.py`` file:
Update the interface in your ``geoportal/<package>_geoportal/__init__.py`` file:
.. code:: python
Expand Down
29 changes: 26 additions & 3 deletions doc/integrator/upgrade_application.rst.mako
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,38 @@ Layer definition for ngeo clients is separate and different from layer
definition for CGXP clients, see :ref:`administrator_administrate_layers`
for details.
To migrate the layer definitions from the CGXP structure to the ngeo
structure, you can use the script ``.build/venv/bin/themev1tov2``.
structure, you can use the script themev1tov2.

In non docker context, run the script from venv:

.. prompt:: bash

.build/venv/bin/themev1tov2 -i geoportal/production.ini

In docker context, run the script from geoportal service:

.. prompt:: bash

docker-compose up -d
docker-compose run --rm geoportal themev1tov2 -i production.ini

Text translations for ngeo clients are separate and different from text
translations for CGXP clients.
To migrate the text translations from CGXP to ngeo, you can use the script

``.build/venv/bin/l10nv1tov2``.
For example, for converting french texts the script can be used as follows:
For example, for converting french texts, in non docker context, the script can
be used as follows:

.. code:: bash

.build/venv/bin/l10nv1tov2 fr geoportal/static/js/Proj/Lang/fr.js ${'\\'}
.build/venv/bin/l10nv1tov2 fr geoportal/<package>_geoportal/static/js/Proj/Lang/fr.js ${'\\'}
geoportal/locale/fr/LC_MESSAGES/geoportal-client.po

In docker context, run the script using docker-compose-run:

.. prompt:: bash

docker-compose up -d
./docker-compose-run l10nv1tov2 fr geoportal/<package>_geoportal/static/js/Proj/Lang/fr.js \
geoportal/<package>_geoportal/locale/fr/LC_MESSAGES/geoportal-client.po
Loading

0 comments on commit 8a5721a

Please sign in to comment.