Feat: Se añade carpeta .dev
This commit is contained in:
parent
15841efc81
commit
9cf1bcae99
2
.dev/Procfile
Executable file
2
.dev/Procfile
Executable file
@ -0,0 +1,2 @@
|
||||
trytond: while true; do trytond -d ${DB_NAME} --dev -v -c $SCRIPT_DIR/trytond.cfg; done
|
||||
monitor: python3 $SCRIPT_DIR/dev.py
|
38
.dev/dev.py
Executable file
38
.dev/dev.py
Executable file
@ -0,0 +1,38 @@
|
||||
# script para refrescar cambios de xml del modulo de tryton
|
||||
import sys
|
||||
import os
|
||||
import logging
|
||||
import time
|
||||
|
||||
import inotify.adapters
|
||||
|
||||
logging.basicConfig(level=logging.INFO, stream=sys.stderr)
|
||||
|
||||
SRC = os.environ['SRC']
|
||||
MODULE_NAME = os.environ['MODULE_NAME']
|
||||
DB_NAME = os.environ['DB_NAME']
|
||||
|
||||
def _main():
|
||||
i = inotify.adapters.Inotify()
|
||||
|
||||
i.add_watch(SRC)
|
||||
logging.info("MONITOREANDO ARCHIVOS EN %s", SRC)
|
||||
|
||||
for event in i.event_gen(yield_nones=False):
|
||||
(_, type_names, path, filename) = event
|
||||
(_, ext) = os.path.splitext(filename)
|
||||
if 'IN_CLOSE_WRITE' not in type_names:
|
||||
continue
|
||||
|
||||
if ext in ['.py', '.xml', '.cfg']:
|
||||
for _ in range(0, 10):
|
||||
if os.system("trytond-admin -d {} -u {}".format(DB_NAME, MODULE_NAME)) != 0:
|
||||
time.sleep(2)
|
||||
logging.error("fallo trytond-admin")
|
||||
else:
|
||||
logging.info("ACTUALIZADO TRYTOND POR CAMBIO DE ARCHIVO %s", filename)
|
||||
break
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
_main()
|
38
.dev/install_module.sh
Normal file
38
.dev/install_module.sh
Normal file
@ -0,0 +1,38 @@
|
||||
# este script fuerza que los cambios se vean reflejados
|
||||
# directamente en trytond.
|
||||
#
|
||||
# variables exportadas:
|
||||
# - module_name
|
||||
|
||||
[ ! -d "$SRC" ] && die "no se ubica ruta en SRC"
|
||||
|
||||
# dependencias minimas
|
||||
pip3 install psycopg2 proteus==7.0.0 inotify honcho qrcode==6.1 pyshp==2.3.1 shapely==2.0.2
|
||||
pip3 install trytond-party trytond-company trytond-product trytond-product_image trytond-currency trytond-notification_email
|
||||
|
||||
for module in modules/*/; do
|
||||
|
||||
pushd "$module"
|
||||
|
||||
# instalar dependencias de tryton desde paquete
|
||||
python3 setup.py install
|
||||
|
||||
# usamos enlace al paquete
|
||||
python3 setup.py develop
|
||||
|
||||
# instalar modulo
|
||||
trytond_modules_path=`pip3 show trytond | grep Location | sed -nr 's/Location: +//gp'`/trytond/modules
|
||||
module_name=`cat "setup.py" | fgrep -A 1 [trytond.modules] | sed 1d | cut -d '=' -f 1 | tr -d ' \n'`
|
||||
[ ! -d "$trytond_modules_path" ] && die "fallo al ubicar ruta de modulos de trytond"
|
||||
ln -sf "$SRC/$module" "$trytond_modules_path/$module_name"
|
||||
rm -rf "$SRC/$module/$module_name"
|
||||
|
||||
popd
|
||||
|
||||
done
|
||||
|
||||
trytond_path=`pip3 show trytond | grep Location | sed -nr 's/Location: +//gp'`/trytond
|
||||
|
||||
if [ -d "locale_custom" ]; then
|
||||
cp -f "locale_custom/ir/pt.po" "$trytond_path/ir/locale/"
|
||||
fi
|
38
.dev/install_module.sh~
Normal file
38
.dev/install_module.sh~
Normal file
@ -0,0 +1,38 @@
|
||||
# este script fuerza que los cambios se vean reflejados
|
||||
# directamente en trytond.
|
||||
#
|
||||
# variables exportadas:
|
||||
# - module_name
|
||||
|
||||
[ ! -d "$SRC" ] && die "no se ubica ruta en SRC"
|
||||
|
||||
# dependencias minimas
|
||||
pip3 install psycopg2 proteus==7.0.0 inotify honcho qrcode==6.1 pyshp==2.3.1 shapely==2.0.2
|
||||
pip3 install trytond-party trytond-company trytond-product trytond-product_image trytond-currency trytond-notification_email
|
||||
|
||||
for module in modules/*/; do
|
||||
|
||||
pushd "$module"
|
||||
|
||||
# instalar dependencias de tryton desde paquete
|
||||
python3 setup.py install
|
||||
|
||||
# usamos enlace al paquete
|
||||
python3 setup.py develop
|
||||
|
||||
# instalar modulo
|
||||
trytond_modules_path=`pip3 show trytond | grep Location | sed -nr 's/Location: +//gp'`/trytond/modules
|
||||
module_name=`cat "setup.py" | fgrep -A 1 [trytond.modules] | sed 1d | cut -d '=' -f 1 | tr -d ' \n'`
|
||||
[ ! -d "$trytond_modules_path" ] && die "fallo al ubicar ruta de modulos de trytond"
|
||||
ln -sf "$SRC/$module" "$trytond_modules_path/$module_name"
|
||||
rm -rf "$SRC/$module/$module_name"
|
||||
|
||||
popd
|
||||
|
||||
done
|
||||
|
||||
trytond_path=`pip3 show trytond | grep Location | sed -nr 's/Location: +//gp'`/trytond
|
||||
|
||||
if [ -d "locale_custom" ]; then
|
||||
cp -f "locale_custom/ir/pt.po" "$trytond_path/ir/locale/"
|
||||
fi
|
31
.dev/run.sh
Executable file
31
.dev/run.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
# script para iniciar entorno vivo
|
||||
|
||||
|
||||
SCRIPT_DIR=$(dirname `realpath $0`)
|
||||
|
||||
die() {
|
||||
echo $1
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ ! -d "$SRC" ] && die "no se ubica ruta en SRC"
|
||||
[ -z "$DB_NAME" ] && die "se requiere variable DB_NAME"
|
||||
|
||||
set -e
|
||||
|
||||
# instalar modulo
|
||||
source ${SCRIPT_DIR}/install_module.sh
|
||||
|
||||
# inicializar base de datos
|
||||
# https://docs.tryton.org/projects/server/en/latest/tutorial/module/setup_database.html
|
||||
yes admin | trytond-admin -d ${DB_NAME} --all --act
|
||||
|
||||
|
||||
# ejecutar servidor
|
||||
export SCRIPT_DIR
|
||||
export MODULE_NAME=$module_name
|
||||
export DB_NAME
|
||||
export SRC
|
||||
|
||||
honcho -d ${SCRIPT_DIR} start
|
3
.dev/trytond.cfg
Executable file
3
.dev/trytond.cfg
Executable file
@ -0,0 +1,3 @@
|
||||
[web]
|
||||
listen = 0.0.0.0:8000
|
||||
root=/var/lib/trytond/www
|
Loading…
Reference in New Issue
Block a user