Commit ce51d38a authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Add the function _do_sencha.

parent d0fd6f0b
......@@ -11,12 +11,17 @@
Helper script to build release and to push version number
in CHANGELOG and VERSION files.
It also performed the installation of the plugins, generated
the documentation and minificated javascript libraries.
The script can install plugins, generated the documentation
and minimised javascript libraries.
The documentation is build using sphinx-build and jsduck while
the javascript minimisation is perform by senchaCmd. These command
can be install on the local host or run via a docker container.
The latter is useful when running in the development area.
EXAMPLES
> build_version -h
> ./build_version -h
AUTHOR
R. Le Gac, renaud.legac@cppm.in2p3.fr
......@@ -74,6 +79,38 @@ JSLIBMIN_CNT = opj(APP_STATIC_CNT, "%s-min.js" % APP)
JSLIBSRC_CNT = opj(APP_STATIC_CNT, APP, "src")
def _do_sencha(sencha, extjssrc, jslibsrc, dbuisrc, jslibdebug, jslibmin):
"""Build javascript libraries when the sencha command is located
on hte local host or run behind a docker container.
Args:
sencha (list): sencha command
extjssrc (str): path to the source directory for Ext JS
jslibsrc (str): path to the source directory for the application
dbuisrc (str): path to the source directory for the plugin dbui
jslibdebug (str): path to the debug version of the library
jslibmin (str): path to the minimised version of the library
"""
cmd = list(sencha)
cmd.extend([
"-sdk", extjssrc,
"compile", "-classpath", "%s,%s" % (jslibsrc, dbuisrc),
"exclude", "--namespace", "Ext,App",
"and", "concat", jslibdebug])
call(cmd)
cmd = list(sencha)
cmd.extend([
"-sdk", extjssrc,
"compile", "-classpath", "%s,%s" % (jslibsrc, dbuisrc),
"exclude", "--namespace", "Ext,App",
"and", "concat", "--yui", jslibmin])
call(cmd)
def build():
"""Compile the javascript code and build documentations.
......@@ -222,53 +259,32 @@ def compile_js():
# NOTE
# the processing depend on the localisation of sencha
# either on the localhost or behind a docker container
# the length of the cmd list allows to separate the two cases
# either on the local host or behind a docker container
# the length of the sencha list allows to separate the two cases
# NOTE
# container is running as root
# permissions have to be changed for the current user
# localhost
# local host
if len(sencha) == 1:
cmd = list(sencha)
cmd.extend([
"-sdk", EXTJSSRC,
"compile", "-classpath", "%s,%s" % (JSLIBSRC, DBUISRC),
"exclude", "--namespace", "Ext,App",
"and", "concat", JSLIBDEBUG])
call(cmd)
cmd = list(sencha)
cmd.extend([
"-sdk", EXTJSSRC,
"compile", "-classpath", "%s,%s" % (JSLIBSRC, DBUISRC),
"exclude", "--namespace", "Ext,App",
"and", "concat", "--yui", JSLIBMIN])
call(cmd)
_do_sencha(sencha,
EXTJSSRC,
JSLIBSRC,
DBUISRC,
JSLIBDEBUG,
JSLIBMIN)
# docker container
else:
cmd = list(sencha)
cmd.extend([
"-sdk", EXTJSSRC_CNT,
"compile", "-classpath", "%s,%s" % (JSLIBSRC_CNT, DBUISRC_CNT),
"exclude", "--namespace", "Ext,App",
"and", "concat", JSLIBDEBUG_CNT])
call(cmd)
cmd = list(sencha)
cmd.extend([
"-sdk", EXTJSSRC_CNT,
"compile", "-classpath", "%s,%s" % (JSLIBSRC_CNT, DBUISRC_CNT),
"exclude", "--namespace", "Ext,App",
"and", "concat", "--yui", JSLIBMIN_CNT])
call(cmd)
_do_sencha(sencha,
EXTJSSRC_CNT,
JSLIBSRC_CNT,
DBUISRC_CNT,
JSLIBDEBUG_CNT,
JSLIBMIN_CNT)
cmd = ["docker", "exec", ARGS.docker_container,
"chown", get_perm(), JSLIBDEBUG_CNT, JSLIBMIN_CNT]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment