Skip to content
Snippets Groups Projects
Commit abd2c023 authored by Vincent Hatakeyama's avatar Vincent Hatakeyama
Browse files

Initial version

parents
No related branches found
No related tags found
No related merge requests found
=======
History
=======
1.0
---
Initial version
do_tests 0 → 100755
#!/bin/zsh
# vim: set shiftwidth=4 softtabstop=4:
#
# This script will create a database, install some modules and run tests on it
#
# Arguments:
#
# - db host if any (will use socket if nothing is provided)
# - db user
# - other arguments are ignored
#
# Required:
#
# - access to pg database
#
# Version 1.0
here=$(dirname $0)
project_home=$here/..
dbname=$(basename $(readlink -f $project_home))_test
# this is the same value as conf/dev/odoo.conf
dbowner=$(python -B -c "import ConfigParser ; c = ConfigParser.ConfigParser() ; c.read('${project_home}/conf/dev/odoo.conf') ; print c.get('options', 'db_user')")
modules_to_install=$(paste -d, -s $project_home/module_list)
# color stuff
autoload colors
if [[ "$terminfo[colors]" -gt 7 ]];
then
colors
fi
for COLOR in RED GREEN YELLOW BLUE MAGENTA CYAN BLACK WHITE; do
eval $COLOR='$fg_no_bold[${(L)COLOR}]'
eval BOLD_$COLOR='$fg_bold[${(L)COLOR}]'
done
eval RESET='$reset_color'
# argument handling
if [[ $# -gt 0 ]];
then
echo ${YELLOW}INFO ${RESET} - Using database host $1
PG_HOST=-h$1
ODOO_HOST=--db_host=$1
shift
if [[ $# -gt 0 ]];
then
echo ${YELLOW}INFO ${RESET} - Using database user $1
PG_USER=-U$1
ODOO_USER=--db_user=$1
dbowner=$1
shift
else
PG_USER=""
ODOO_USER=""
fi
else
PG_HOST=""
ODOO_HOST=""
PG_USER=""
ODOO_USER=""
fi
echo ${YELLOW}INFO ${RESET} - Drop any existing database "$dbname"
dropdb $PG_HOST $PG_USER --if-exists $dbname
echo ${YELLOW}INFO ${RESET} - Create database "$dbname" with owner $dbowner
createdb $PG_HOST $PG_USER -O $dbowner $dbname || { echo ${RED}FATAL${RESET} - Cannot create test database ; exit 1; }
unaccent=$(python -B -c "import ConfigParser ; c = ConfigParser.ConfigParser() ; c.read('${project_home}/conf/dev/odoo.conf') ; print c.get('options', 'unaccent', False)")
if [[ "$unaccent" == "True" ]];
then
psql $PG_HOST $PG_USER $dbname -c "CREATE EXTENSION unaccent;"
fi
echo ${YELLOW}INFO ${RESET} - Modules to install: $modules_to_install
echo ${YELLOW}INFO ${RESET} - Install those modules
$here/start -i $modules_to_install -d $dbname --log-level=warn --max-cron=0 --stop-after-init $ODOO_HOST $ODOO_USER || { echo ${RED}FATAL${RESET} - Cannot install modules ; exit 1; }
logfile=$(tempfile --suffix=.log)
echo ${YELLOW}INFO ${RESET} - Run tests on $dbname
$here/run_tests $dbname $ODOO_HOST $ODOO_USER | tee $logfile
ok=$(grep ' OK' $logfile -c)
failed=$(grep ' FAILED' $logfile -c)
echo ''
echo '***** Test results *****'
echo "$ok modules passing, $failed modules failing"
echo ''
if [[ $ok -gt 0 ]];
then
echo '\tOK:'
grep ' OK' $logfile || true
fi
if [[ $failed -gt 0 ]];
then
echo '\tFAILED:'
grep FAILED $logfile
fi
echo ''
rm $logfile
if [[ $failed -gt 0 ]];
then
exit 1
fi
#!/bin/zsh
# Version 1.0
dbname=$1
here=$(dirname $0)
if [[ -z "$dbname" ]];
then
dbname=$(basename $(readlink -f $project_home))_test
else
shift
fi
echo "Using database $dbname"
$here/start -d $dbname --test-enable --log-level=debug --max-cron=0 --stop-after-init $*
[bumpversion]
current_version = 1.1
parse = (?P<major>\d+)\.(?P<minor>\d+)(?P<release>(_a|b|rc|.)?)(?P<patch>\d*)(_post(?P<post>\d+))?
serialize =
{major}.{minor}{release}{patch}.post{post}
{major}.{minor}{release}{patch}
{major}.{minor}{release}
{major}.{minor}
tag_name = TAG_{new_version}
[bumpversion:file:VERSION]
[bumpversion:file:doc/conf.py]
search =
release = '{current_version}'
replace =
release = '{new_version}'
[bumpversion:part:release]
values =
a
b
rc
.
optional_value = .
[bumpversion:file:requirements]
[bumpversion:file:bin/do_tests]
[bumpversion:file:bin/run_tests]
[bumpversion:file:bin/start]
[bumpversion:file:conf/dev/odoo.conf]
[bumpversion:file:doc/Makefile]
[bumpversion:file:dev_install]
[bumpversion:file:.drone.yml]
start 0 → 100755
#!/bin/sh
# vim: set shiftwidth=4 softtabstop=4:
#
# This script start odoo for development
#
# You can set ODOO_DATA_DIR and ODOO_DB_HOST if you want to avoid using the default value ($HOME/var/tmp and localhost)
#
# Version 1.1
here=$(readlink -f $(dirname $0)/..)
echo "Starting odoo for development"
python=python
# module_path will be .../<directory>/openerp/__init__.pyc
module_path=$(python -B -c "import os;import openerp;print os.path.abspath(openerp.__file__)")
if test -z "$module_path";
then
virtualenv_name=$(basename $(readlink -f $(dirname start)))
echo "No odoo found, trying $virtualenv_name virtualenvwrapper"
# assume you use virtualenvwrapper, and try the same env name as the project
python=$WORKON_HOME/$virtualenv_name/bin/python
if [ -e $python ];
then
module_path=$($python -B -c "import os;import openerp;print os.path.abspath(openerp.__file__)")
fi
if test -z "$module_path";
then
echo "No odoo found, trying /opt/odoo/sources/odoo/openerp-server"
if test -e "/opt/odoo/sources/odoo/openerp-server";
then
python=/usr/bin/python
module_path="/opt/odoo/sources/odoo/openerp/__init__.py"
else
echo "No odoo found, did you activate your env?"
exit 1
fi
fi
fi
odoo=$(dirname $(dirname $module_path))
echo "Odoo directory: $odoo"
if [ -e "$odoo/.git" ];
then
odoo_version="git $(cd $odoo && git rev-parse HEAD)"
elif [ -e "$odoo/.bzr" ];
then
odoo_version="bzr $(cd $odoo && bzr revno)"
elif [ -e "$odoo/.hg" ];
then
odoo_version="hg $(cd $odoo && hg id)"
else
odoo_version="Unknown"
fi
echo "Odoo version: $odoo_version"
# odoo7, odoo8 or bzr
ODOO_TYPE=$(cat odoo_type)
args=$*
if [ "$ODOO_TYPE" = "odoo8" ];
then
if echo $args | grep -q -e "\( \|^\)--data-dir";
then
data_dir=""
else
data_dir=" --data-dir=$odoo/var/tmp"
fi
else
data_dir=""
fi
if echo $args | grep -q -e "\( \|^\)--db_host";
then
db_host=""
else
db_host="--db_host=localhost"
fi
if echo $args | grep -q -e "\( \|^\)-c" -e "\( \|^\)--config";
then
config=""
addons_path=""
else
config="-c conf/dev/odoo.conf"
if echo $args | grep -q -e "\( \|^\)--addons-path";
then
addons_path=""
else
if [ "$ODOO_TYPE" = "bzr" ];
then
addons_path="--addons-path=$($python -B -c "print(','.join(['$HOME/src/openobject-addons','$HOME/src/openerp-web/addons']+['$here/'+line for line in open('addon_dirs').read().splitlines()]))")"
else
addons_path="--addons-path=$($python -B -c "print(','.join(['$odoo/addons']+['$here/'+line for line in open('addon_dirs').read().splitlines()]))")"
fi
fi
fi
$python $odoo/openerp-server $config $db_host $data_dir $addons_path $args
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment