From fd70112911a40ff8df9c1bfb358b285cec3838c3 Mon Sep 17 00:00:00 2001 From: Olivier DOSSMANN Date: Thu, 14 Jan 2016 14:47:23 +0100 Subject: [PATCH] [IMP] Launch script: permit to add arguments after 'dev' command (for an example to make a migration after having changed some migration files) --- launch.sh | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/launch.sh b/launch.sh index db0cb5e..70f21d0 100755 --- a/launch.sh +++ b/launch.sh @@ -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