[IMP] Launch script: permit to add arguments after 'dev' command (for an

example to make a migration after having changed some migration files)
This commit is contained in:
Olivier DOSSMANN 2016-01-14 14:47:23 +01:00
parent 97fd235430
commit fd70112911

View File

@ -80,15 +80,24 @@ not_implemented() {
}
show_help() {
echo "$PROGRAM [COMMAND]"
echo "$PROGRAM COMMAND [arg ...]"
echo -e " Where ${green}COMMAND${reset} is one of:"
echo -e " - create Create postgreSQL database volume and postgreSQL Docker container"
echo -e " - dev Mount git repository directory as volume for Gissmo Docker container and launch it in 'development' mode"
echo -e " - init Create project directory as python virtual environment, fetch git repository and install Python dependancies"
echo -e " - migrate Launch migration command: python manage.py migrate"
echo -e " - restore dump Restore the given dump"
echo -e " - start args Launch Gissmo Docker container (created by 'create' command) with a name given in GISSMO_DOCKER_NAME variable. args is optional."
echo -e " - stop Stop Gissmo Docker container which name is GISSMO_DOCKER_NAME variable content"
echo -e " - create Create postgreSQL database volume and \\
postgreSQL Docker container"
echo -e " - dev [arg ...] Mount Git repository directory AS VOLUME \\
for Gissmo Docker container and launch it in \\
'development' mode"
echo -e " - init Create project directory as python virtual \\
environment, fetch git repository and install \\
Python dependancies"
echo -e " - migrate Launch migration command: \\
python manage.py migrate"
echo -e " - restore dump Restore the given dump"
echo -e " - start [arg ...] Launch Gissmo Docker container \\
(created by 'create' command) with a name given \\
in GISSMO_DOCKER_NAME variable. args is optional."
echo -e " - stop Stop Gissmo Docker container which name is \\
GISSMO_DOCKER_NAME variable content"
echo ""
echo "For an example you can use it in this order:"
echo ""
@ -179,7 +188,7 @@ dev() {
# Run existing Docker container, otherwise create a new one
GISSMO_RUNNING=$($docker_cmd inspect --format="{{ .State.Running }}" ${GISSMO_DOCKER_NAME} 2> /dev/null)
if [ $? -eq 1 ]; then
$docker_cmd run -it --rm --link ${POSTGRES_DOCKER_NAME}:db -p ${GISSMO_DOCKER_PORT}:8000 -v ${GISSMO_DIR}:/opt/gissmo --name ${GISSMO_DOCKER_NAME} gissmo:${GISSMO_VERSION} development || error_and_quit "Failed to create and launch ${GISSMO_DOCKER_NAME} container."
$docker_cmd run -it --rm --link ${POSTGRES_DOCKER_NAME}:db -p ${GISSMO_DOCKER_PORT}:8000 -v ${GISSMO_DIR}:/opt/gissmo --name ${GISSMO_DOCKER_NAME} gissmo:${GISSMO_VERSION} ${ARGS:='development'} || error_and_quit "Failed to create and launch ${GISSMO_DOCKER_NAME} container."
else
error_and_quit "${GISSMO_DOCKER_NAME} is already launched! If you need another name please set GISSMO_DOCKER_NAME in configuration file."
fi