diff --git a/Excel/backup/Ratio_Cuisine_Vers4.2.101.xlsm b/Excel/backup/Ratio_Cuisine_Vers4.2.101.xlsm deleted file mode 100644 index b997ab1..0000000 Binary files a/Excel/backup/Ratio_Cuisine_Vers4.2.101.xlsm and /dev/null differ diff --git a/Excel/backup/Ratio_Cuisine_Vers4.2.102.xlsm b/Excel/backup/Ratio_Cuisine_Vers4.2.102.xlsm deleted file mode 100644 index 607563b..0000000 Binary files a/Excel/backup/Ratio_Cuisine_Vers4.2.102.xlsm and /dev/null differ diff --git a/Excel/backup/Ratio_Cuisine_Vers4.2.103.xlsm b/Excel/backup/Ratio_Cuisine_Vers4.2.103.xlsm deleted file mode 100644 index 607563b..0000000 Binary files a/Excel/backup/Ratio_Cuisine_Vers4.2.103.xlsm and /dev/null differ diff --git a/Excel/backup/Ratio_Cuisine_Vers4.2.104.xlsm b/Excel/backup/Ratio_Cuisine_Vers4.2.104.xlsm deleted file mode 100644 index 320d49b..0000000 Binary files a/Excel/backup/Ratio_Cuisine_Vers4.2.104.xlsm and /dev/null differ diff --git a/Excel/backup/Ratio_Cuisine_Vers4.2.105.xlsm b/Excel/backup/Ratio_Cuisine_Vers4.2.105.xlsm deleted file mode 100644 index 69803ba..0000000 Binary files a/Excel/backup/Ratio_Cuisine_Vers4.2.105.xlsm and /dev/null differ diff --git a/Excel/backup/Ratio_Cuisine_Vers4.2.106.xlsm b/Excel/backup/Ratio_Cuisine_Vers4.2.106.xlsm deleted file mode 100644 index 09fd535..0000000 Binary files a/Excel/backup/Ratio_Cuisine_Vers4.2.106.xlsm and /dev/null differ diff --git a/Excel/backup/Ratio_Cuisine_Vers4.2.107.xlsm b/Excel/backup/Ratio_Cuisine_Vers4.2.107.xlsm deleted file mode 100644 index 09fd535..0000000 Binary files a/Excel/backup/Ratio_Cuisine_Vers4.2.107.xlsm and /dev/null differ diff --git a/Excel/backup/Ratio_Cuisine_Vers4.2.108.xlsm b/Excel/backup/Ratio_Cuisine_Vers4.2.108.xlsm deleted file mode 100644 index c2f1b22..0000000 Binary files a/Excel/backup/Ratio_Cuisine_Vers4.2.108.xlsm and /dev/null differ diff --git a/Excel/backup/Ratio_Cuisine_Vers4.2.109.xlsm b/Excel/backup/Ratio_Cuisine_Vers4.2.109.xlsm deleted file mode 100644 index 4c80902..0000000 Binary files a/Excel/backup/Ratio_Cuisine_Vers4.2.109.xlsm and /dev/null differ diff --git a/Excel/backup/Ratio_Cuisine_Vers4.2.110.xlsm b/Excel/backup/Ratio_Cuisine_Vers4.2.110.xlsm deleted file mode 100644 index 3b7da19..0000000 Binary files a/Excel/backup/Ratio_Cuisine_Vers4.2.110.xlsm and /dev/null differ diff --git a/Excel/backup/Ratio_Restauration_Vers2.1.52.xlsm b/Excel/backup/Ratio_Restauration_Vers2.1.52.xlsm deleted file mode 100644 index 4704774..0000000 Binary files a/Excel/backup/Ratio_Restauration_Vers2.1.52.xlsm and /dev/null differ diff --git a/Excel/backup/Ratio_Restauration_Vers2.1.53.xlsm b/Excel/backup/Ratio_Restauration_Vers2.1.53.xlsm deleted file mode 100644 index 1348dfb..0000000 Binary files a/Excel/backup/Ratio_Restauration_Vers2.1.53.xlsm and /dev/null differ diff --git a/Excel/backup/Ratio_Restauration_Vers2.1.54.xlsm b/Excel/backup/Ratio_Restauration_Vers2.1.54.xlsm deleted file mode 100644 index 5850b43..0000000 Binary files a/Excel/backup/Ratio_Restauration_Vers2.1.54.xlsm and /dev/null differ diff --git a/Excel/backup/Ratio_Restauration_Vers2.1.55.xlsm b/Excel/backup/Ratio_Restauration_Vers2.1.55.xlsm deleted file mode 100644 index efdad60..0000000 Binary files a/Excel/backup/Ratio_Restauration_Vers2.1.55.xlsm and /dev/null differ diff --git a/Excel/backup/Ratio_Restauration_Vers2.1.56.xlsm b/Excel/backup/Ratio_Restauration_Vers2.1.56.xlsm deleted file mode 100644 index d230876..0000000 Binary files a/Excel/backup/Ratio_Restauration_Vers2.1.56.xlsm and /dev/null differ diff --git a/Excel/backup/Ratio_Restauration_Vers2.1.57.xlsm b/Excel/backup/Ratio_Restauration_Vers2.1.57.xlsm deleted file mode 100644 index 449a858..0000000 Binary files a/Excel/backup/Ratio_Restauration_Vers2.1.57.xlsm and /dev/null differ diff --git a/Excel/backup/Ratio_Restauration_Vers2.1.58.xlsm b/Excel/backup/Ratio_Restauration_Vers2.1.58.xlsm deleted file mode 100644 index 449a858..0000000 Binary files a/Excel/backup/Ratio_Restauration_Vers2.1.58.xlsm and /dev/null differ diff --git a/Excel/backup/Ratio_Restauration_Vers2.1.59.xlsm b/Excel/backup/Ratio_Restauration_Vers2.1.59.xlsm deleted file mode 100644 index 449a858..0000000 Binary files a/Excel/backup/Ratio_Restauration_Vers2.1.59.xlsm and /dev/null differ diff --git a/Excel/backup/Ratio_Restauration_Vers2.1.60.xlsm b/Excel/backup/Ratio_Restauration_Vers2.1.60.xlsm deleted file mode 100644 index 2db0b3c..0000000 Binary files a/Excel/backup/Ratio_Restauration_Vers2.1.60.xlsm and /dev/null differ diff --git a/Excel/backup/Ratio_Restauration_Vers2.1.61.xlsm b/Excel/backup/Ratio_Restauration_Vers2.1.61.xlsm deleted file mode 100644 index c7e4255..0000000 Binary files a/Excel/backup/Ratio_Restauration_Vers2.1.61.xlsm and /dev/null differ diff --git a/Scripts/Maj_prod_Cuisine.bat b/Scripts/Maj_prod_Cuisine.bat index cee9545..96a01c0 100644 --- a/Scripts/Maj_prod_Cuisine.bat +++ b/Scripts/Maj_prod_Cuisine.bat @@ -3,7 +3,8 @@ setlocal ENABLEDELAYEDEXPANSION cd /d "%~dp0" -REM === PARAMETRES CUISINE === +echo --- Mise en prod Ratio_Cuisine --- + set "ROOT=%~dp0.." set "VERSION_FILE=%ROOT%\Excel\dev\Ratio_Cuisine_VERSION.txt" @@ -13,32 +14,43 @@ set "DST=%DST_DIR%\Ratio_Cuisine.xlsm" set "BACKUP_DIR=%ROOT%\Excel\backup" set KEEP_BACKUPS=10 -REM === Lire ancienne version pour nom sauvegarde === +echo. +echo ROOT = %ROOT% +echo SRC = %SRC% +echo DST = %DST% +echo BACKUP_DIR = %BACKUP_DIR% +echo VERSION_FILE= %VERSION_FILE% +echo. + set "OLD_VERSION=" if exist "%VERSION_FILE%" ( set /p OLD_VERSION=<"%VERSION_FILE%" ) -REM === Vérifications === if not exist "%SRC%" ( echo ERREUR : fichier source introuvable : echo %SRC% - pause exit /b 1 ) if not exist "%DST_DIR%" ( echo ERREUR : dossier de destination introuvable : echo %DST_DIR% - pause exit /b 1 ) if not exist "%BACKUP_DIR%" ( + echo Creation du dossier backup : + echo %BACKUP_DIR% mkdir "%BACKUP_DIR%" ) -REM === Sauvegarde de l'ancienne prod avant remplacement === +if exist "%DST_DIR%\~$Ratio_Cuisine.xlsm" ( + echo ERREUR : Ratio_Cuisine.xlsm est ouvert dans Excel. + echo Ferme le classeur de production avant de relancer la mise en prod. + exit /b 1 +) + if exist "%DST%" ( if "%OLD_VERSION%"=="" ( set "BACKUP=%BACKUP_DIR%\Ratio_Cuisine_sansVersion.xlsm" @@ -47,35 +59,57 @@ if exist "%DST%" ( ) echo Sauvegarde de l'ancienne production... - copy /Y "%DST%" "%BACKUP%" + echo De : %DST% + echo Vers : !BACKUP! + + copy /Y "%DST%" "!BACKUP!" + + if errorlevel 1 ( + echo ERREUR : la sauvegarde de l'ancienne production a echoue. + exit /b 1 + ) + + if not exist "!BACKUP!" ( + echo ERREUR : le fichier de sauvegarde n'a pas ete cree. + echo Attendu : !BACKUP! + exit /b 1 + ) + + echo Sauvegarde OK : !BACKUP! +) else ( + echo Aucun ancien fichier de production trouve, pas de sauvegarde a faire. ) -REM === Copie DEV vers PROD === +echo. echo Copie vers la version de production... copy /Y "%SRC%" "%DST%" if errorlevel 1 ( echo ERREUR lors de la copie vers production. - pause exit /b 1 ) -REM === Mise à jour version TXT + cellule C1 du classeur PROD === -echo Mise à jour de version... +if not exist "%DST%" ( + echo ERREUR : le fichier de production n'a pas ete cree. + exit /b 1 +) + +echo. +echo Mise a jour de version... python "%~dp0maj_version.py" "%VERSION_FILE%" "%DST%" if errorlevel 1 ( - echo ERREUR lors de la mise à jour de version. - pause + echo ERREUR lors de la mise a jour de version. exit /b 1 ) -REM === Nettoyage sauvegardes anciennes === +echo. echo Nettoyage des anciennes sauvegardes Cuisine... for /f "skip=%KEEP_BACKUPS% delims=" %%F in ('dir /b /a-d /o-d "%BACKUP_DIR%\Ratio_Cuisine_Vers*.xlsm" 2^>nul') do ( echo Suppression ancienne sauvegarde : %%F del /q "%BACKUP_DIR%\%%F" ) -echo Terminé. -exit /b 0 +echo. +echo --- Mise en prod terminee --- +exit /b 0 \ No newline at end of file diff --git a/Scripts/Maj_prod_Restauration.bat b/Scripts/Maj_prod_Restauration.bat index 5af2955..9cf094f 100644 --- a/Scripts/Maj_prod_Restauration.bat +++ b/Scripts/Maj_prod_Restauration.bat @@ -14,6 +14,14 @@ set "DST=%DST_DIR%\Ratio_Restauration.xlsm" set "BACKUP_DIR=%ROOT%\Excel\backup" set KEEP_BACKUPS=10 +echo. +echo ROOT = %ROOT% +echo SRC = %SRC% +echo DST = %DST% +echo BACKUP_DIR = %BACKUP_DIR% +echo VERSION_FILE= %VERSION_FILE% +echo. + set "OLD_VERSION=" if exist "%VERSION_FILE%" ( set /p OLD_VERSION=<"%VERSION_FILE%" @@ -32,9 +40,16 @@ if not exist "%DST_DIR%" ( ) if not exist "%BACKUP_DIR%" ( + echo Creation du dossier backup : + echo %BACKUP_DIR% mkdir "%BACKUP_DIR%" ) +if exist "%DST_DIR%\~$Ratio_Restauration.xlsm" ( + echo ERREUR : Ratio_Restauration.xlsm est ouvert dans Excel. + exit /b 1 +) + if exist "%DST%" ( if "%OLD_VERSION%"=="" ( set "BACKUP=%BACKUP_DIR%\Ratio_Restauration_sansVersion.xlsm" @@ -43,13 +58,28 @@ if exist "%DST%" ( ) echo Sauvegarde de l'ancienne production... - if exist "%DST_DIR%\~$Ratio_Restauration.xlsm" ( - echo ERREUR : Ratio_Restauration.xlsm est ouvert dans Excel. - exit /b 1 -) - copy /Y "%DST%" "%BACKUP%" + echo De : %DST% + echo Vers : !BACKUP! + + copy /Y "%DST%" "!BACKUP!" + + if errorlevel 1 ( + echo ERREUR : la sauvegarde de l'ancienne production a echoue. + exit /b 1 + ) + + if not exist "!BACKUP!" ( + echo ERREUR : le fichier de sauvegarde n'a pas ete cree. + echo Attendu : !BACKUP! + exit /b 1 + ) + + echo Sauvegarde OK : !BACKUP! +) else ( + echo Aucun ancien fichier de production trouve, pas de sauvegarde a faire. ) +echo. echo Copie vers la version de production... copy /Y "%SRC%" "%DST%" @@ -58,19 +88,27 @@ if errorlevel 1 ( exit /b 1 ) -echo Mise à jour de version... -python "%~dp0maj_version.py" "%VERSION_FILE%" "%DST%" - -if errorlevel 1 ( - echo ERREUR lors de la mise à jour de version. +if not exist "%DST%" ( + echo ERREUR : le fichier de production n'a pas ete cree. exit /b 1 ) +echo. +echo Mise a jour de version... +python "%~dp0maj_version.py" "%VERSION_FILE%" "%DST%" + +if errorlevel 1 ( + echo ERREUR lors de la mise a jour de version. + exit /b 1 +) + +echo. echo Nettoyage des anciennes sauvegardes Restauration... for /f "skip=%KEEP_BACKUPS% delims=" %%F in ('dir /b /a-d /o-d "%BACKUP_DIR%\Ratio_Restauration_Vers*.xlsm" 2^>nul') do ( echo Suppression ancienne sauvegarde : %%F del /q "%BACKUP_DIR%\%%F" ) +echo. echo --- Mise en prod terminee --- exit /b 0 \ No newline at end of file