diff --git a/bin/lib/odoo.lib b/bin/lib/odoo.lib index 9fd8d04..e2b357f 100644 --- a/bin/lib/odoo.lib +++ b/bin/lib/odoo.lib @@ -1,6 +1,7 @@ #!/bin/bash -#odoo.lib # +# Library: odoo.lib +# Modified: 2024/11/30 15:27:00 # Derechos de Autor (C) [2024] [Mauro Rosero P. ] # # Este programa es software libre: usted puede redistribuirlo y/o modificarlo @@ -16,25 +17,58 @@ # Debería haber recibido una copia de la Licencia Pública Affero General # junto con este programa. Si no la recibió, consulte . -# Función para crear la estructura de archivos para proyecto de desarrollo local Odoo - Contenedores -odoo_structure() { - if [[ ! -f "${POSTGRES_PATH}" ]] - then - mkdir -p "${POSTGRES_PATH}" - fi - if [[ ! -f "${POSTGRES_INIT}" ]] - then - mkdir -p "${POSTGRES_INIT}" - fi +DOCKER_LOCAL=dockerfile.local +DOCKER_BASE=dockerfile.base +DOCKER_SAAS=dockerfile.saas +DOCKER_BUILD=build +DOCKER_FILE=Dockerfile - if [[ ! -f "${ODOO_DATA}" ]] - then - mkdir -p "${ODOO_DATA}" - fi +ODOO_APP=apps +ODOO_DOC=docs +ODOO_ETC=etc +ODOO_CFG=config - if [[ ! -f "${ODOO_BACKUPS}" ]] +# Test odoo library +function odoolib_test() { + echo "Odoo Library loaded!" +} + +# Create odoo project structured path +function odoo_structure() { + + local ODOO_PATH=$1 + local ODOO_PROJ=$2 + + if [[ ! -d "${ODOO_PATH}" ]] then - mkdir -p "${ODOO_BACKUPS}" + echo "${odmsg_002}" + return 1 + else + if [[ ! -d "${ODOO_PATH}/${ODOO_PROJ}" ]] + then + mkdir -p $ODOO_PATH/$ODOO_PROJ/{$DOCKER_BUILD,$ODOO_APP,$ODOO_DOC,$ODOO_ETC} + if [ $? -eq 0 ] + then + echo "[x] $odmsg_008_1 $ODOO_PROJ $odmsg_008_2" + fi + fi + fi +} + +# Copy docker file to build +function copy_dockerfile() { + + local ODOO_PATH=$1 + local ODOO_PROJ=$2 + local DOCKERFILE=$3 + + if [ ! -f "$ODOO_PATH/$ODOO_PROJ/$DOCKER_BUILD/$DOCKER_FILE" ] + then + cp $DOCKERFILE "$ODOO_PATH/$ODOO_PROJ/$DOCKER_BUILD/$DOCKER_FILE" + if [ $? -eq 0 ] + then + echo "[x] $odmsg_009" + fi fi } diff --git a/bin/msg/head.es b/bin/msg/head.es index f409c96..8ce7427 100644 --- a/bin/msg/head.es +++ b/bin/msg/head.es @@ -18,6 +18,7 @@ head_info="INFO" head_warning="ADVERTENCIA" head_error="ERROR" head_unknow="UNKNOW" +head_version="Versión" os_update="Actualizando sistema operativo " os_nofound="Sistemas operativos soportados: Ubuntu, Debian, Arch Linux, Fedora, Redhat, AlmaLinux, Rocky, Oracle Linux, FreeBSD, MacOS" diff --git a/bin/msg/odoo.es b/bin/msg/odoo.es new file mode 100644 index 0000000..4c31c78 --- /dev/null +++ b/bin/msg/odoo.es @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +#bash script : odoo.es +#apps : Odoo Developer Utilities +#description : Bootstrap Translate Messages (es) +#author : MRP/mrp - Mauro Rosero P. +#company email : mauro@rosero.one +#personal email : mauro.rosero@gmail.com +#date : 20240201 +#version : 1.0.2 +#notes : +#============================================================================== +#============================================================================== + +odmsg_000="(ODOO TOOLS)" +odmsg_001="- PROYECTO NUEVO" +odmsg_002="Ambiente de desarrollo Odoo no instalado!" +odmsg_003_1="Uso:" +odmsg_003_2=" [--help] [--version]" +odmsg_004="Descripción: Este script requiere un argumento obligatorio." +odmsg_005="Opciones:" +odmsg_006=" --help Muestra este mensaje de ayuda." +odmsg_007=" --version Muestra la versión del script." +odmsg_008_1="Estructura de carpetas de proyecto" +odmsg_008_2="fue creada!" +odmsg_009="Dockerfile fue creado!" diff --git a/bin/project.sh b/bin/project.sh index 6888633..fc00008 100755 --- a/bin/project.sh +++ b/bin/project.sh @@ -22,6 +22,7 @@ DEVSTEAM=odoo BIN_HOME=$HOME/$DEVSPATH/$DEVSTEAM BIN_MESG=bin/msg BIN_LIBS=bin/lib +VERSION="1.0" # CHECK SHELL LANGUAGE BIN_LANG=${LANG:0:2} @@ -30,9 +31,50 @@ BIN_LANG=${LANG:0:2} source $BIN_HOME/$BIN_LIBS/base.lib #baselib_test +# LOAD ODOO BASH LIBRARY +source $BIN_HOME/$BIN_LIBS/odoo.lib +#odoolib_test + # Load head messages load_messages $BIN_HOME $BIN_MESG $BIN_LANG "head" -# Display Headers -display_text_header $BIN_HOME "$bomsg_000 $head_000" +# Load odoo messages +load_messages $BIN_HOME $BIN_MESG $BIN_LANG "odoo" +# Function to display help message +function help() { + echo "$odmsg_003_1 $0 $odmsg_003_2" + echo "$odmsg_004" + echo "$odmsg_005" + echo "$odmsg_006" + echo "$odmsg_007" +} + +# Display Headers +display_text_header $BIN_HOME "${odmsg_000} ${odmsg_001}" + +# Check for arguments option +for arg in "$@"; do + case $arg in + --help) + help + exit 0 + ;; + --version) + echo "$head_version $VERSION" + exit 0 + ;; + esac +done + +# Check if mandatory argument is provided +if [ -z "$1" ]; then + help + exit 1 +fi + +# Create odoo project path +odoo_structure $BIN_HOME "$1" + +# Copy Dockerfile to build (local) +copy_dockerfile $BIN_HOME "$1" "$BIN_HOME/$ODOO_CFG/$DOCKER_LOCAL"