Commit c7d7da53 authored by Alexander's avatar Alexander
Browse files

upd 3. issue https://resprojects.ru/issues/163

1) Some change in .gitlab-ci.yml. Changed application packing stage
2) Added two scripts (for linux and windows) for running application.
3) Switching off colorized output into console because does not display correctly into windows console. 
parent bd79c712
Pipeline #90 passed with stages
in 1 minute and 22 seconds
......@@ -46,33 +46,8 @@ package:
- "rm -r -d -f lnkchkr/"
- "mkdir -p lnkchkr"
- "cp target/linkchecker-0.1.0.jar lnkchkr/linkchecker.jar"
- "touch lnkchkr/application-production.properties"
- "echo \"LINKCHECKER_PGSQL_DB_HOST=\" >> lnkchkr/application-production.properties"
- "echo \"LINKCHECKER_PGSQL_DB_PORT=\" >> lnkchkr/application-production.properties"
- "echo \"LINKCHECKER_PGSQL_DB_NAME=\" >> lnkchkr/application-production.properties"
- "echo \"LINKCHECKER_PGSQL_DB_USER=\" >> lnkchkr/application-production.properties"
- "echo \"LINKCHECKER_PGSQL_DB_PASSWORD=\" >> lnkchkr/application-production.properties"
- "touch lnkchkr/linkchecker_win_demo.bat"
- "touch lnkchkr/linkchecker_win_demo_debug.bat"
- "touch lnkchkr/linkchecker_win_production.bat"
- "touch lnkchkr/linkchecker_win_production_debug.bat"
- "echo \"java -jar linkchecker.jar\" >> lnkchkr/linkchecker_win_demo.bat"
- "echo \"java -jar linkchecker.jar --spring.profiles.active=demo,debug\" >> lnkchkr/linkchecker_win_demo_debug.bat"
- "echo \"java -jar linkchecker.jar --spring.profiles.active=production\" >> lnkchkr/linkchecker_win_production.bat"
- "echo \"java -jar linkchecker.jar --spring.profiles.active=production,debug\" >> lnkchkr/linkchecker_win_production_debug.bat"
- "touch lnkchkr/linkchecker_linux_demo.sh"
- "touch lnkchkr/linkchecker_linux_demo_debug.sh"
- "touch lnkchkr/linkchecker_linux_production.sh"
- "touch lnkchkr/linkchecker_linux_production_debug.sh"
- "echo \"#!/bin/bash\" >> lnkchkr/linkchecker_linux_demo.sh"
- "echo \"java -jar linkchecker.jar\" >> lnkchkr/linkchecker_linux_demo.sh"
- "echo \"#!/bin/bash\" >> lnkchkr/linkchecker_linux_demo_debug.sh"
- "echo \"java -jar linkchecker.jar --spring.profiles.active=demo,debug\" >> lnkchkr/linkchecker_linux_demo_debug.sh"
- "echo \"#!/bin/bash\" >> lnkchkr/linkchecker_linux_production.sh"
- "echo \"java -jar linkchecker.jar --spring.profiles.active=production\" >> lnkchkr/linkchecker_linux_production.sh"
- "echo \"#!/bin/bash\" >> lnkchkr/linkchecker_linux_production_debug.sh"
- "echo \"java -jar linkchecker.jar --spring.profiles.active=production,debug\" >> lnkchkr/linkchecker_linux_production_debug.sh"
- "chmod +x -R lnkchkr/linkchecker_linux_production_debug.sh lnkchkr/linkchecker_linux_production.sh lnkchkr/linkchecker_linux_demo_debug.sh lnkchkr/linkchecker_linux_demo.sh"
- "cp linkchecker_linux.sh lnkchkr/linkchecker_linux.sh"
- "cp linkchecker_win.bat lnkchkr/linkchecker_win.bat"
- "ls -l"
artifacts:
......
#!/bin/bash
EXECUTABLE_FILE=linkchecker.jar
PROPERTIES_FILE=application-production.properties
HELP="Usage: linkchecker_linux [KEY]
Script without key is run program in DEMO mode. Also vailable next switches:
--debug - running program in DEMO mode with extended debug information.
--production - running program in PRODUCTION mode. For running in this mode needed additional
file application-production.properties with PostgreSQL dataset information. Also for this mode
available addition key --debug for runnning program with extended debug information.
Examples:
linkchecker_linux - run program in DEMO mode
linkchecker_linux --debug - run program in DEMO mode with extended information.
linkchecker_linux --production - run program in PRODUCTION mode.
linkchecker_linux --production --debug - run program in PRODUCTION mode with extended debug information.
For more information see https://gitlab.com/Aleksandrov/linkchecker/wikis/
"
PROPERTIES_FILE_NOT_FOUND="
WARNING!
You try run program in PRODUCTION mode. For this mode need PostgreSQL but file
$PROPERTIES_FILE with dataset information is not found. Please fill next information and run program again!
"
if [ -f "$EXECUTABLE_FILE" ]; then
if [ -z "$1" ]; then
echo "Running program in DEMO mode"
java -jar linkchecker.jar
else
case "$1" in
--debug)
echo "Running program in DEMO mode with extended debug information"
java -jar linkchecker.jar --spring.profiles.active=demo,debug
;;
--production)
if [ -f "$PROPERTIES_FILE" ]; then
if [ -z "$2" ]; then
echo "Running program in PRODUCTION mode"
java -jar linkchecker.jar --spring.profiles.active=production
else
if [ "$2" = "--debug" ]; then
echo "Running program in PRODUCTION mode with extended debug information"
java -jar linkchecker.jar --spring.profiles.active=production,debug
else
echo "$HELP"
fi
fi
else
echo "$PROPERTIES_FILE_NOT_FOUND"
printf 'PostgreSQL database host name or IP address (default localhost): '
read LINKCHECKER_PGSQL_DB_HOST
if [ -z "$LINKCHECKER_PGSQL_DB_HOST" ]; then
LINKCHECKER_PGSQL_DB_HOST="jdbc:postgresql://localhost"
else
LINKCHECKER_PGSQL_DB_HOST="jdbc:postgresql://$LINKCHECKER_PGSQL_DB_HOST"
fi
printf 'PostgreSQL database port (default 5432): '
read LINKCHECKER_PGSQL_DB_PORT
if [ -z "$LINKCHECKER_PGSQL_DB_PORT" ]; then
LINKCHECKER_PGSQL_DB_PORT=5432
fi
printf 'PostgreSQL database name (default linkchecker): '
read LINKCHECKER_PGSQL_DB_NAME
if [ -z "$LINKCHECKER_PGSQL_DB_NAME" ]; then
LINKCHECKER_PGSQL_DB_NAME="linkchecker"
fi
printf 'PostgreSQL database user name: '
read LINKCHECKER_PGSQL_DB_USER
printf 'PostgreSQL database password: '
read -s LINKCHECKER_PGSQL_DB_PASSWORD
echo
touch "$PROPERTIES_FILE"
echo "LINKCHECKER_PGSQL_DB_HOST=$LINKCHECKER_PGSQL_DB_HOST" >> "$PROPERTIES_FILE"
echo "LINKCHECKER_PGSQL_DB_PORT=$LINKCHECKER_PGSQL_DB_PORT" >> "$PROPERTIES_FILE"
echo "LINKCHECKER_PGSQL_DB_NAME=$LINKCHECKER_PGSQL_DB_NAME" >> "$PROPERTIES_FILE"
echo "LINKCHECKER_PGSQL_DB_USER=$LINKCHECKER_PGSQL_DB_USER" >> "$PROPERTIES_FILE"
echo "LINKCHECKER_PGSQL_DB_PASSWORD=$LINKCHECKER_PGSQL_DB_PASSWORD" >> "$PROPERTIES_FILE"
fi
;;
*)
echo "$HELP"
;;
esac
fi
else
echo "Executable file linkchecker.jar is not found!"
fi
\ No newline at end of file
@echo off
set EXECUTABLE_FILE=linkchecker.jar
set PROPERTIES_FILE=application-production.properties
if not exist %EXECUTABLE_FILE% (
echo Executable file linkchecker.jar is not found!
exit /b
)
if ""=="%1" (
echo Running program in DEMO mode
java -jar %EXECUTABLE_FILE%
) else (
if "--debug"=="%1" (
echo Running program in DEMO mode with extended debug information
java -jar linkchecker.jar --spring.profiles.active=demo,debug
) else (
if "--production"=="%1" (
if exist %PROPERTIES_FILE% (
if ""=="%2" (
echo Running program in PRODUCTION mode
java -jar linkchecker.jar --spring.profiles.active=production
) else (
if "--debug"=="%2" (
echo Running program in PRODUCTION mode with extended debug information
java -jar linkchecker.jar --spring.profiles.active=production,debug
) else goto :Help
)
) else (
goto :PROPERTIES_FILE_NOT_FOUND
)
) else goto :Help
)
)
exit /B
:Help
echo Usage: linkchecker_win [KEY]
echo.
echo Script without key is run program in DEMO mode. Also vailable next switches:
echo.
echo --debug - running program in DEMO mode with extended debug information.
echo.
echo --production - running program in PRODUCTION mode. For running in this mode needed additional file application-production.properties with PostgreSQL dataset information. Also for this mode available addition key --debug for runnning program with extended debug information.
echo.
echo Examples:
echo.
echo linkchecker_win - run program in DEMO mode
echo.
echo linkchecker_win --debug - run program in DEMO mode with extended information.
echo.
echo linkchecker_win --production - run program in PRODUCTION mode.
echo.
echo linkchecker_win --production --debug - run program in PRODUCTION mode with extended debug information.
echo.
echo For more information see https://gitlab.com/Aleksandrov/linkchecker/wikis/
exit /b
:PROPERTIES_FILE_NOT_FOUND
setlocal
echo WARNING!
echo.
echo You try run program in PRODUCTION mode. For this mode need PostgreSQL but file %PROPERTIES_FILE% with dataset information is not found. Please fill next information and run program again!
echo.
set /p PRMT="PostgreSQL database host name or IP address (default localhost): "
if ""=="%PRMT%" (
set LINKCHECKER_PGSQL_DB_HOST=jdbc:postgresql://localhost
) else (
set LINKCHECKER_PGSQL_DB_HOST=jdbc:postgresql://%PRMT%
)
set /p PRMT1="PostgreSQL database port (default 5432): "
if ""=="%PRMT1%" set LINKCHECKER_PGSQL_DB_PORT=5432
set /p PRMT2="PostgreSQL database name (default linkchecker): "
if ""=="%PRMT2%" set LINKCHECKER_PGSQL_DB_NAME=linkchecker
set /p LINKCHECKER_PGSQL_DB_USER="PostgreSQL database user name: "
call :getPassword LINKCHECKER_PGSQL_DB_PASSWORD "PostgreSQL database password: "
echo.
echo LINKCHECKER_PGSQL_DB_HOST=%LINKCHECKER_PGSQL_DB_HOST%>%PROPERTIES_FILE%
echo LINKCHECKER_PGSQL_DB_PORT=%LINKCHECKER_PGSQL_DB_PORT%>>%PROPERTIES_FILE%
echo LINKCHECKER_PGSQL_DB_NAME=%LINKCHECKER_PGSQL_DB_NAME%>>%PROPERTIES_FILE%
echo LINKCHECKER_PGSQL_DB_USER=%LINKCHECKER_PGSQL_DB_USER%>>%PROPERTIES_FILE%
echo LINKCHECKER_PGSQL_DB_PASSWORD=%LINKCHECKER_PGSQL_DB_PASSWORD%>>%PROPERTIES_FILE%
endlocal
exit /b
::------------------------------------------------------------------------------
:: Masks user input and returns the input as a variable.
:: Password-masking code based on http://www.dostips.com/forum/viewtopic.php?p=33538#p33538
::
:: Arguments: %1 - the variable to store the password in
:: %2 - the prompt to display when receiving input
::------------------------------------------------------------------------------
:getPassword
set "_password="
:: We need a backspace to handle character removal
for /f %%a in ('"prompt;$H&for %%b in (0) do rem"') do set "BS=%%a"
:: Prompt the user
set /p "=%~2" <nul
:keyLoop
:: Retrieve a keypress
set "key="
for /f "delims=" %%a in ('xcopy /l /w "%~f0" "%~f0" 2^>nul') do if not defined key set "key=%%a"
set "key=%key:~-1%"
:: If No keypress (enter), then exit
:: If backspace, remove character from password and console
:: Otherwise, add a character to password and go ask for next one
if defined key (
if "%key%"=="%BS%" (
if defined _password (
set "_password=%_password:~0,-1%"
set /p "=!BS! !BS!"<nul
)
) else (
set "_password=%_password%%key%"
set /p "="<nul
)
goto :keyLoop
)
echo/
:: Return password to caller
set "%~1=%_password%"
goto :eof
\ No newline at end of file
......@@ -66,7 +66,7 @@ spring:
preferred-json-mapper: gson
output:
ansi:
enabled: always
enabled: detect
logging:
level:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment