Skip to content
Snippets Groups Projects
Commit 021d052a authored by Armand Bahi's avatar Armand Bahi
Browse files

update utils

parent b37fccc5
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
#
#
# Récupère les modifications des modules sur l'application
#
#
if [ `whoami` == "root" ]; then
echo "Please, do not run this script as sudo"
else
cd utils/
./pull_subtrees.sh
fi
#!/bin/bash
#
#
# Envoie les modifications de l'application sur les modules
#
#
if [ `whoami` == "root" ]; then
echo "Please, do not run this script as sudo"
else
cd utils/
./push_subtrees.sh
fi
robocopy "githooks" "../.git/hooks" /E /NFL /NDL /NJH /NJS /nc /ns /np
#!/bin/bash
#
#
# Script de mise à jour des hooks client
#
#
#
if [ -d "githooks" ]; then
if [ -d "../.git/hooks" ]; then
cp -f githooks/* ../.git/hooks/
fi
fi
#!/bin/bash
#
# Récupère l'ensemble des dépendances depuis conf/_install/dependency.xml
#
#
#
#
if [ "../conf/_install/dependency.xml" ]; then
declare -A aDeps
vitisVersion=master
depsCount=0
dependencies=($(cat "../conf/_install/dependency.xml" | tr -d '\040\011\012\015' | grep -oP '<dependency>([\s\S]*?)<\/dependency>'))
for i in ${!dependencies[*]}; do
sName=$(grep -oP '(?<=name>)[^<]+' <<< ${dependencies[$i]})
sVersion=$(grep -oP '(?<=version>)[^<]+' <<< ${dependencies[$i]})
sNature=$(grep -oP '(?<=nature>)[^<]+' <<< ${dependencies[$i]})
if [ $sName == "vitis" ]; then
vitisVersion=$sVersion
fi
if [ $sNature == "modules" ] || [ $sNature == "web_services" ] || [ $sName == "vitis" ]; then
aDeps[$i, name]=$sName
aDeps[$i, version]=$sVersion
aDeps[$i, nature]=$sNature
let depsCount++
fi
done
echo "[INFO] dependencies:"
echo "vitis : $vitisVersion"
for i in ${!dependencies[*]}; do
echo "(${aDeps[$i, nature]}) ${aDeps[$i, name]} : ${aDeps[$i, version]}"
done
echo "depsCount : ${depsCount}"
export vitisVersion
export depsCount
export aDeps
else
echo "[ERROR] ../conf/_install/dependency.xml not found"
fi
#!/bin/sh
#
# Hook qui permet de pull toutes les dépendances
# quand on fait un pull sur l'application
#
#
#
#
#
echo "****** Post-merge Hook ******"
echo "****** Pull ******"
# echo "****** Pull subtrees ******"
# echo "$(pwd)"
#
# if [ -d "$(pwd)/utils" ]; then
# cd utils
# ./pull_subtrees.sh
# fi
#!/bin/sh
#
# Hook qui permet de push toutes les dépendances
# quand on fait un push sur l'application
#
#
#
#
#
remote="$1"
url="$2"
if [ $remote != $url ]; then
echo "****** Pre-push Hook ******"
echo "****** Push ******"
# echo "****** Push subtrees ******"
# if [ -d "$(pwd)/utils" ]; then
# cd utils
# ./push_subtrees.sh
# fi
fi
#!/bin/bash
#
#
# Script d'initialisation d'un dépot vMap versionné sous git
# Initislise l'ensemble des dépendances sous forme de subtrees
#
# Nécessite xmllint : sudo apt install libxml2-utils
#
APP_NAME="vmap"
# Récupère la liste des dépendances
. ./get_deps.sh
cd ..
if [ -d "$(pwd)/client" ]; then
rm client
fi
if [ -d "$(pwd)/vas" ]; then
rm vas
fi
if [ -d "$(pwd)/src" ]; then
git rm -r src
git commit -a -m "Reset sources"
fi
mkdir src
if [[ $depsCount > 0 ]]; then
# Vitis
echo "---- Init vitis ----"
git subtree add --squash -m "add subtree" --prefix src/vitis "git@gitlab.veremes.net:Development/vitis_apps/sources/vitis.git" $vitisVersion
echo "---- Init conf ----"
git subtree add --squash -m "add subtree" --prefix src/closure "git@gitlab.veremes.net:Development/vitis_apps/sources/closure.git" master
# Modules
for (( i=1; i <= $depsCount; i++ )); do
if [ ${aDeps[$i, nature]} == "modules" ]; then
echo "---- Init ${aDeps[$i, name]} : ${aDeps[$i, version]}----"
# Ajoute le dépôt
git subtree add --squash -m "add subtree" --prefix src/${aDeps[$i, name]} "git@gitlab.veremes.net:Development/vitis_apps/sources/${aDeps[$i, name]}.git" ${aDeps[$i, version]}
fi
done
fi
#!/bin/bash
#
#
# Script d'initialisation d'un dépot vMap versionné sous git
#
# Split repo
# git subtree split -P module/ -b module_split_branch
#
# Add subtree
# git subtree add --prefix vmap "git@gitlab.veremes.net:Development/vitis_apps/sources/Vitis.git" master
#
#
echo -n "Existing app path (path/empty)? "
read APP_EXISTING_PATH
# Récupère la liste des dépendances
. ./get_deps.sh
cd ..
# Supprime les anciens symlinks
if [ -d "client" ]; then
rm -Rf client
fi
if [ -d "vas" ]; then
rm -Rf vas
fi
find src/vitis/client -type l -delete
find src/vitis/vas/sql -type l -delete
find src/vitis/vas/rest -type l -delete
# Vitis
echo "---- Link vitis ----"
if ! [ -e "$(pwd)/client" ]; then
mkdir client
mkdir client/javascript
mkdir client/modules
ln -rsf src/vitis/client/css client/css
ln -rsf src/vitis/client/forms client/forms
ln -rsf src/vitis/client/images client/images
ln -rsf src/vitis/client/javascript/app client/javascript/app
ln -rsf src/vitis/client/javascript/externs client/javascript/externs
ln -rsf src/vitis/client/javascript/require client/javascript/require
ln -rsf src/vitis/client/lang client/lang
ln -rsf src/vitis/client/less client/less
ln -rsf src/vitis/client/modules/vitis client/modules/vitis
ln -rsf src/vitis/client/templates client/templates
ln -rsf src/vitis/client/.htaccess client/.htaccess
ln -rsf src/vitis/client/index.html client/index.html
fi
if ! [ -e "$(pwd)/vas" ]; then
mkdir vas
mkdir vas/rest
mkdir vas/rest/ws
ln -rsf src/vitis/vas/doc vas/doc
ln -rsf src/vitis/vas/rest/class vas/rest/class
ln -rsf src/vitis/vas/rest/inc vas/rest/inc
ln -rsf src/vitis/vas/rest/ws/vitis vas/rest/ws/vitis
ln -rsf src/vitis/vas/rest/index.phtml vas/rest/index.phtml
ln -rsf src/vitis/vas/rest/index.vhtml vas/rest/index.vhtml
ln -rsf src/vitis/vas/sql vas/sql
ln -rsf src/vitis/vas/util vas/util
fi
# Conf
echo "---- Link conf ----"
if ! [ -e "src/vitis/client/conf" ]; then
# ln -rsf conf client/conf
mkdir client/conf
for elem in $( ls "conf"); do
if [[ $elem != 'properties.json' ]]; then
if [[ -d "conf/${elem}" || -f "conf/${elem}" ]]; then
echo "---- Link conf/$elem"
ln -rsf conf/$elem client/conf/$elem
fi
fi
done
fi
if ! [ -e "conf/closure" ]; then
ln -rsf src/closure/conf conf/closure
fi
# Modules
if [[ $depsCount > 0 ]]; then
for (( i=1; i <= $depsCount; i++ )); do
if [ ${aDeps[$i, nature]} == "modules" ]; then
if [ ${aDeps[$i, name]:0:7} == "module_" ]; then
module=${aDeps[$i, name]:7}
echo "---- Link module_${module} ----"
if [ -d "$(pwd)/src/module_${module}/module" ]; then
if ! [ -e "src/vitis/client/modules/${module}" ]; then
ln -rsf src/module_${module}/module client/modules/${module}
fi
fi
if [ -d "$(pwd)/src/module_${module}/web_service/ws" ]; then
if ! [ -e "src/vitis/vas/rest/ws/${module}" ]; then
ln -rsf src/module_${module}/web_service/ws vas/rest/ws/${module}
fi
fi
if [ -d "$(pwd)/src/module_${module}/web_service/sql" ]; then
if ! [ -e "src/vitis/vas/sql/${module}" ]; then
ln -rsf src/module_${module}/web_service/sql vas/sql/${module}
fi
fi
if [ -d "$(pwd)/src/module_${module}/web_service/class" ]; then
for class_dir in $( ls "$(pwd)/src/module_${module}/web_service/class"); do
if [ -d "$(pwd)/src/module_${module}/web_service/class/${class_dir}" ]; then
echo "---- Link module_${module}/${class_dir} ----"
if ! [ -e "src/vitis/vas/rest/class/${class_dir}" ]; then
ln -rsf src/module_${module}/web_service/class/${class_dir} vas/rest/class/${class_dir}
fi
fi
done
fi
fi
fi
done
# Utilisation d'une install déjà existante
if [ -d "${APP_EXISTING_PATH}" ]; then
echo "---- Link exixting app ${APP_EXISTING_PATH} ----"
declare -a existing_folders_path=("vas/server"
"vas/rest/conf"
"vas/log"
"vas/public"
"vas/shared"
"vas/tmp"
"vas/upload"
"vas/ws_data")
for folder_path in "${existing_folders_path[@]}"; do
if [ -d "${APP_EXISTING_PATH}/$folder_path" ]; then
echo "copy $folder_path"
cp -Rf "${APP_EXISTING_PATH}/$folder_path" "$(pwd)/$folder_path"
chmod 777 -R "$(pwd)/$folder_path"
fi
done
declare -a existing_files_path=("client/conf/properties.json"
"vas/rest/.htaccess")
for file_path in "${existing_files_path[@]}"; do
if [ -f "${APP_EXISTING_PATH}/$file_path" ]; then
echo "copy $file_path"
cp -f "${APP_EXISTING_PATH}/$file_path" "$(pwd)/$file_path"
fi
done
for properties_dir in $( ls "${APP_EXISTING_PATH}/vas/rest/conf"); do
if [ -d "${APP_EXISTING_PATH}/vas/rest/conf/${properties_dir}" ]; then
echo "copy ${APP_EXISTING_PATH}/vas/rest/conf/${properties_dir}/ > $(pwd)/vas/rest/conf/"
cp -Rf "${APP_EXISTING_PATH}/vas/rest/conf/${properties_dir}/" "$(pwd)/vas/rest/conf/"
fi
done
fi
fi
@echo off
title Install Vitis App
setlocal EnableDelayedExpansion
cd ..
set /p existing_path="Existing app path: "
REM Client Dir
echo Create client directory
if exist "client" (
rmdir /S /Q "client"
)
echo copy client
robocopy "src/vitis/client" "client" /E /NFL /NDL /NJH /NJS /nc /ns /np
echo copy client/conf
robocopy "conf" "client/conf" /E /NFL /NDL /NJH /NJS /nc /ns /np
echo copy client/conf/closure
robocopy "src/closure/conf" "client/conf/closure" /E /NFL /NDL /NJH /NJS /nc /ns /np
echo Copy client modules
for /d %%g in ("src/module_*") do (
set x=%%g
echo !x:~7!
if exist "src/%%g/module" (
echo copy client/modules/!x:~7!
robocopy "src/%%g/module" "client/modules/!x:~7!" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
)
REM VAS dir
echo Create vas directory
echo Create client directory
if exist "vas" (
rmdir /S /Q "vas"
)
echo copy vas
robocopy "src/vitis/vas" "vas" /E /NFL /NDL /NJH /NJS /nc /ns /np
echo Copy vas web_services
for /d %%g in ("src/module_*") do (
set x=%%g
echo !x:~7!
if exist "src/%%g/web_service/conf" (
echo copy vas/rest/conf/!x:~7!
robocopy "src/%%g/web_service/conf" "vas/rest/conf/!x:~7!" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
if exist "src/%%g/web_service/sql" (
echo copy vas/sql/!x:~7!
robocopy "src/%%g/web_service/sql" "vas/sql/!x:~7!" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
if exist "src/%%g/web_service/ws" (
echo copy vas/rest/ws/!x:~7!
robocopy "src/%%g/web_service/ws" "vas/rest/ws/!x:~7!" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
if exist "src/%%g/web_service/class" (
echo copy vas/rest/class
robocopy "src/%%g/web_service/class" "vas/rest/class" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
if exist "src/%%g/web_service/ws_data" (
echo copy vas/ws_data
robocopy "src/%%g/web_service/ws_data" "vas/ws_data" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
if exist "src/%%g/web_service/public" (
echo copy vas/public
robocopy "src/%%g/web_service/public" "vas/public" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
if exist "src/%%g/web_service/upload" (
echo copy vas/upload
robocopy "src/%%g/web_service/upload" "vas/upload" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
)
REM Copy from existing path
if exist %existing_path% (
echo copy properties from %existing_path%
for %%G in (vas\server,vas\rest\conf,vas\log,vas\public,vas\shared,vas\tmp,vas\upload,vas\ws_data) do (
echo %%G
if exist %existing_path%\%%G (
echo copy %%G
robocopy "%existing_path%\%%G" "%%G" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
)
if exist %existing_path%\client\conf\properties.json (
echo copy properties.json
robocopy "%existing_path%\client\conf" "client\conf" "properties.json" /NFL /NDL /NJH /NJS /nc /ns /np
)
if exist %existing_path%\vas\rest\.htaccess (
echo copy .htaccess
robocopy "%existing_path%\vas\rest" "vas\rest" ".htaccess" /NFL /NDL /NJH /NJS /nc /ns /np
)
if exist "%existing_path%\vas\rest\conf" (
echo copy vas\rest\conf
robocopy "%existing_path%\vas\rest\conf" "vas\rest\conf" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
)
#!/bin/bash
#
#
# Script d'initialisation d'un dépot vMap versionné sous git
# Initislise l'ensemble des dépendances sous forme de subtrees
#
#
#
APP_NAME="vmap"
# Récupère la liste des dépendances
. ./get_deps.sh
cd ..
# Vitis
echo "---- Pull vitis ----"
git subtree pull --prefix src/vitis --squash -m "pull subtree" "git@gitlab.veremes.net:Development/vitis_apps/sources/vitis.git" $vitisVersion
# Modules
if [[ $depsCount > 0 ]]; then
for (( i=1; i <= $depsCount; i++ )); do
if [ ${aDeps[$i, nature]} == "modules" ]; then
echo "---- Pull ${aDeps[$i, name]} ----"
# Ajoute le dépôt
git subtree pull --prefix src/${aDeps[$i, name]} --squash -m "pull subtree" "git@gitlab.veremes.net:Development/vitis_apps/sources/${aDeps[$i, name]}.git" ${aDeps[$i, version]}
fi
done
fi
#!/bin/bash
#
#
# Script d'initialisation d'un dépot vMap versionné sous git
# Initislise l'ensemble des dépendances sous forme de subtrees
#
#
#
APP_NAME="vmap"
# Récupère la liste des dépendances
. ./get_deps.sh
cd ..
# Vitis
echo "---- Push vitis ----"
{ # 'try' block
git subtree push --prefix src/vitis "git@gitlab.veremes.net:Development/vitis_apps/sources/vitis.git" $vitisVersion
} || { # 'catch' block
echo "could not push vitis"
}
# Modules
if [[ $depsCount > 0 ]]; then
for (( i=1; i <= $depsCount; i++ )); do
if [ ${aDeps[$i, nature]} == "modules" ]; then
echo "---- Push ${aDeps[$i, name]} ----"
# Push le dépôt
{ # 'try' block
git subtree push --prefix src/${aDeps[$i, name]} "git@gitlab.veremes.net:Development/vitis_apps/sources/${aDeps[$i, name]}.git" ${aDeps[$i, version]}
} || { # 'catch' block
echo "could not push ${aDeps[$i, name]}"
}
fi
done
fi
@echo off
title Update Vitis tree
echo Update Vitis tree
setlocal EnableDelayedExpansion
cd utils
REM Pull repo
"C:\Program Files\Git\bin\sh.exe" --login -i -c "git pull"
REM Pull subtrees
"C:\Program Files\Git\bin\sh.exe" --login -i -c "./pull_subtrees.sh"
REM Save important files
if exist "../vas/rest/sql" (
robocopy "../vas/rest/sql" "../vas/rest/sql_bak" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
if exist "../vas/rest/conf" (
robocopy "../vas/rest/conf" "../vas/rest/conf_bak" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
REM Replace Vitis files
for /d %%g in ("../src/vitis/client/*") do (
set x=%%g
echo copy client/!x!
rmdir /S /Q "../client/!x!"
robocopy "../src/vitis/client/!x!" "../client/!x!" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
for /d %%g in ("../src/vitis/vas/sql") do (
echo copy vas/sql
rmdir /S /Q "../vas/sql"
robocopy "../src/vitis/vas/sql" "../vas/sql" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
for /d %%g in ("../src/vitis/vas/rest/class") do (
echo copy vas/rest/class
rmdir /S /Q "../vas/rest/class"
robocopy "../src/vitis/vas/rest/class" "../vas/rest/class" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
for /d %%g in ("../src/vitis/vas/rest/conf") do (
echo copy vas/rest/conf
robocopy "../src/vitis/vas/rest/conf" "../vas/rest/conf_veremes" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
for /d %%g in ("../src/vitis/vas/rest/inc") do (
echo copy vas/rest/inc
rmdir /S /Q "../vas/rest/inc"
robocopy "../src/vitis/vas/rest/inc" "../vas/rest/inc" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
for /d %%g in ("../src/vitis/vas/rest/ws") do (
echo copy vas/rest/ws
rmdir /S /Q "../vas/rest/ws"
robocopy "../src/vitis/vas/rest/ws" "../vas/rest/ws" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
REM Replace modules files
for /d %%g in ("../src/module_*") do (
set x=%%g
if exist "../src/%%g/module" (
echo copy client/modules/!x:~7!
robocopy "../src/%%g/module" "../client/modules/!x:~7!" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
if exist "../src/%%g/web_service/conf" (
echo copy vas/rest/conf_veremes/!x:~7!
robocopy "../src/%%g/web_service/conf" "../vas/rest/conf_veremes/!x:~7!" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
if exist "../src/%%g/web_service/sql" (
echo copy vas/sql/!x:~7!
robocopy "../src/%%g/web_service/sql" "../vas/sql/!x:~7!" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
if exist "../src/%%g/web_service/ws" (
echo copy vas/rest/ws/!x:~7!
robocopy "../src/%%g/web_service/ws" "../vas/rest/ws/!x:~7!" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
if exist "../src/%%g/web_service/class" (
echo copy vas/rest/class
robocopy "../src/%%g/web_service/class" "../vas/rest/class" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
)
cd ..
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment