From 60faea94d02394d3904badcc972afb142c6c0694 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 15 Apr 2016 17:56:52 -0400 Subject: [PATCH 01/11] Fix -f (force) option in dsh update boot2docker --- bin/dsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/dsh b/bin/dsh index e78ca8e..6183861 100755 --- a/bin/dsh +++ b/bin/dsh @@ -1286,7 +1286,7 @@ case $1 in if [[ "$1" == "prerequisites" ]]; then install_prerequisites elif [[ "$1" == "boot2docker" ]]; then - update_boot2docker + update_boot2docker $* elif [[ "$1" == "images" ]]; then update_images elif [[ "$1" == "dsh" ]]; then From c716671d5bbebde3146b341358f86c653ab23cf6 Mon Sep 17 00:00:00 2001 From: Bassam Ismail Date: Sat, 16 Apr 2016 07:11:26 +0530 Subject: [PATCH 02/11] Update drude-env-setup.md --- docs/drude-env-setup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/drude-env-setup.md b/docs/drude-env-setup.md index 489e7bc..bbc1505 100644 --- a/docs/drude-env-setup.md +++ b/docs/drude-env-setup.md @@ -54,7 +54,7 @@ Babun should be installed and run **as a regular user (do not use admin command dsh install boot2docker ``` - On Mac and Widnows you should see two files created in the `projects` folder: + On Mac and Windows you should see two files created in the `projects` folder: ``` Vagrantfile From 2f21fdefb043c5648a07954d77c796cb344baec2 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Mon, 18 Apr 2016 09:39:55 -0400 Subject: [PATCH 03/11] Update directory-structure.md Add details that folder name and location can be arbitrary. --- docs/directory-structure.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/directory-structure.md b/docs/directory-structure.md index c6795e3..77ce8a9 100644 --- a/docs/directory-structure.md +++ b/docs/directory-structure.md @@ -1,13 +1,13 @@ # Directory structure -Drude enforces a directory structure where you have an arbitrary located and named `projects` folder. -All your projects go into subfolders under the `projects` folder. +Drude enforces a directory structure where all your projects go into subfolders under the main `` folder. +The `` folder can be arbitrarily located and named. It is best to put it on the fastest drive you have. -`dsh` will install the necessary boot2docker-vagrant VM files (`Vagrantfile` and `vagrant.yml`) into the `projects` folder. +`dsh` will install the necessary boot2docker-vagrant VM files (`Vagrantfile` and `vagrant.yml`) into the `` folder. ``` + ... - - projects + - |--- drupal-site | docker-compose.yml | docroot From e67c400a664d7523815131a6fdaf9ba54ffda710 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Wed, 20 Apr 2016 10:05:18 -0400 Subject: [PATCH 04/11] Run `update boot2docker` interactively on Windows --- bin/dsh | 79 ++++++++++++++++++++++++++------------------------------- 1 file changed, 36 insertions(+), 43 deletions(-) diff --git a/bin/dsh b/bin/dsh index 6183861..e3c66a1 100755 --- a/bin/dsh +++ b/bin/dsh @@ -1,6 +1,6 @@ #!/bin/bash -DSH_VERSION=1.12.11 +DSH_VERSION=1.12.12 # Console colors red='\033[0;31m' @@ -30,36 +30,6 @@ echo-red () { echo -e "${red}$1${NC}"; } echo-green () { echo -e "${green}$1${NC}"; } echo-yellow () { echo -e "${yellow}$1${NC}"; } -# Check whether shell is interactive -# Otherwise we are running in a non-interactive script environment -is_tty () -{ - # Override option via $DRUDE_IS_TTY (true|false) env variable. - if [[ $DRUDE_IS_TTY == 'true' ]]; then - return 0; - fi - if [[ $DRUDE_IS_TTY == 'false' ]]; then - return 1; - fi - - # disable interactive shell on windows for now - # known Docker issue: https://github.com/docker/docker/issues/12469 - res=$(uname | grep 'CYGWIN_NT') - if [[ "$res" != '' ]]; then - return 1; - fi - - [[ "$(/usr/bin/tty || true)" != "not a tty" ]] -} - -testing_warn () -{ - if ! is_tty ; then return; fi - if [[ ! $B2D_BRANCH == 'master' ]] || [[ ! $DRUDE_BRANCH == 'master' ]]; then - echo-yellow "dsh: boot2docker - ${B2D_BRANCH}, drude - ${DRUDE_BRANCH}" - fi -} - # Exits dsh if previous command exited with non-zero code if_failed () { @@ -152,14 +122,6 @@ get_mysql_connect () # Use this function for every docker-compose invocation. docker_compose () { - # TODO: remove this - # if is_windows; then - # # Trim CR(\r) from the output, otherwise there will be issues passing it to the docker binary on Windows. - # docker-compose $* | tr -d '\r' - # else - # docker-compose $* - # fi - docker-compose $* } @@ -297,6 +259,37 @@ is_docker_running () return $? } +# Check whether shell is interactive +# Otherwise we are running in a non-interactive script environment +is_tty () +{ + # Override option via $DRUDE_IS_TTY (true|false) env variable. + if [[ $DRUDE_IS_TTY == 'true' ]]; then + return 0; + fi + if [[ $DRUDE_IS_TTY == 'false' ]]; then + return 1; + fi + + # disable interactive shell on windows for now + # known Docker issue: https://github.com/docker/docker/issues/12469 + if is_windows; then + return 1; + fi + + [[ "$(/usr/bin/tty || true)" != "not a tty" ]] +} + +#---------------------------- Other helper functions ------------------------------- + +testing_warn () +{ + if ! ( is_tty || is_windows ); then return; fi + if [[ ! $B2D_BRANCH == 'master' ]] || [[ ! $DRUDE_BRANCH == 'master' ]]; then + echo-yellow "dsh: boot2docker - ${B2D_BRANCH}, drude - ${DRUDE_BRANCH}" + fi +} + #---------------------------- Control functions ------------------------------- check_docker_running () @@ -345,8 +338,8 @@ is_yml_absent () # @param $1 confirmation message _confirm () { - # Skip checks if not a tty - if ! is_tty ; then return 0; fi + # Skip checks if not running interactively (not a tty or not on Windows) + if ! ( is_tty || is_windows ); then return 0; fi while true; do read -p "$1 [y/n]: " answer @@ -840,7 +833,7 @@ update_images () update_boot2docker () { testing_warn - if ! is_tty ; then + if ! ( is_tty || is_windows ); then echo "'update' is not allowed in a non-interactive environment." return 1 fi @@ -949,7 +942,7 @@ _bash () # Interactive shell requires a tty. # On Windows we assume we run interactively via winpty (console.exe). - if ! (is_tty || is_windows) ; then + if ! ( is_tty || is_windows ); then echo "Interactive bash console in a non-interactive enveronment!? Nope, won't happen." return 1 fi From ea496e4d1d1d3b0d8adfbdc091a6870b2b1a991d Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Wed, 20 Apr 2016 10:22:39 -0400 Subject: [PATCH 05/11] Fix dsh bash regression from 1.5.0 1.5.0 broke dsh bash on Linux and ran it via Vagrant on Mac --- bin/dsh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/bin/dsh b/bin/dsh index e3c66a1..861ecbe 100755 --- a/bin/dsh +++ b/bin/dsh @@ -957,14 +957,21 @@ _bash () fi local container_id container_id=$(get_container_id $container_name) - if is_windows && is_binary_found console; then - # Workaround - run docker via winpty (console.exe) to get a tty console in cygwin. - console docker exec -it $container_id bash -i + # Running docker exec interactively on Windows requires workarounds + if is_windows; then + # Workaround 1 - run docker exec via winpty (console.exe) to get a tty console in cygwin. + if is_binary_found 'console'; then + console docker exec -it $container_id bash -i + # Workaround 2 - run docker exec via `vagrant ssh -c` + else + # Drop /cygdrive prefix if the working directory is opened as /cygdrive//.. instead of /.. + cwd=$(pwd); cwd=${cwd#/cygdrive} + command="cd $cwd && docker exec -it $container_id bash -i"; + vagrant ssh -c "$command" + fi + # Run docker exec interactively directly if not on Windows else - # Drop /cygdrive prefix if the working directory is opened as /cygdrive//.. instead of /.. - cwd=$(pwd); cwd=${cwd#/cygdrive} - command="cd $cwd && docker exec -it $container_id bash -i"; - vagrant ssh -c "$command" + docker exec -it $container_id bash -i fi fi } From d43471f36c66bcc1ff23509d4477d3a09ee4ea77 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Wed, 20 Apr 2016 16:18:07 -0400 Subject: [PATCH 06/11] Refactor and cleanup misc. checks (check_docker_running) --- bin/dsh | 59 +++++++++++++++++++++++++++------------------------------ 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/bin/dsh b/bin/dsh index 861ecbe..e2972ba 100755 --- a/bin/dsh +++ b/bin/dsh @@ -215,17 +215,15 @@ is_vagrant () } # check that docker-compose binary exists -is_docker_compose () +check_docker_compose () { binary_found 'docker-compose'; - return $? } # check that docker binary exists -is_docker () +check_docker () { binary_found 'docker'; - return $? } is_docker_running () @@ -294,6 +292,9 @@ testing_warn () check_docker_running () { + check_docker + check_docker_compose + check_yml if ! is_docker_running; then echo-red "dsh: Unable to connect to the docker daemon"; exit 1 @@ -334,6 +335,13 @@ is_yml_absent () return 1 } +check_yml() +{ + if is_yml_absent; then + exit 2 + fi +} + # Yes/no confirmation dialog with an optional message # @param $1 confirmation message _confirm () @@ -526,7 +534,7 @@ bash_comp_words () # Start containers up () { - if is_yml_absent ; then return 2; fi + check_yml if is_vagrant ; then if ! is_docker_running; then echo-green "dsh: Starting vagrant vm..." @@ -535,10 +543,10 @@ up () else started=0 fi - if [ $started -eq 0 ] && is_docker_compose ; then + if [ $started -eq 0 ] ; then _start_containers fi - elif ( is_boot2docker || is_linux ) && is_docker_compose ; then + elif ( is_boot2docker || is_linux ) ; then _start_containers fi } @@ -547,17 +555,13 @@ up () down () { check_docker_running - if is_yml_absent ; then return 2; fi - if is_docker_compose ; then - _stop_containers $@ - fi + _stop_containers $@ } # Stop Vagrant box halt () { check_docker_running - if is_yml_absent ; then return 2; fi if is_vagrant ; then vagrant halt elif ( is_boot2docker || is_linux ) ; then @@ -569,22 +573,22 @@ halt () # @param $1 container_name restart () { - if is_yml_absent ; then return 2; fi + check_docker_running _restart_containers $* } # Restart Vagrant and start containers again reload () { - if is_yml_absent ; then return 2; fi + check_yml if is_vagrant ; then echo-green "dsh: Restarting vagrant vm..." vagrant reload started=$? - if [ $started -eq 0 ] && is_docker_compose ; then + if [ $started -eq 0 ] ; then _start_containers fi - elif ( is_boot2docker || is_linux ) && is_docker_compose ; then + elif ( is_boot2docker || is_linux ) ; then _start_containers fi } @@ -598,7 +602,6 @@ status () if [[ "$1" == "-a" ]] || [[ "$1" == "--all" ]]; then docker ps else - if is_yml_absent ; then return 2; fi cd $(yml_get_path) docker_compose ps fi @@ -937,9 +940,6 @@ update_dsh () # @param $1 container name (defaults to cli) _bash () { - if is_yml_absent ; then return 2; fi - cd $(yml_get_path) - # Interactive shell requires a tty. # On Windows we assume we run interactively via winpty (console.exe). if ! ( is_tty || is_windows ); then @@ -980,10 +980,7 @@ _bash () # @param $* command with it's params to run run () { - if is_docker && is_docker_compose ; then - check_docker_running - cd $(yml_get_path) - container_id=$(get_container_id cli) + check_docker_running if is_tty ; then # need to use $* here to finally resolve slash-escaped string if any. @@ -1024,7 +1021,7 @@ _run () # start interactive mysql shell mysql () { - if is_yml_absent ; then return 2; fi + check_docker_running if ! get_drush_path; then return; fi _run $(get_mysql_connect)" -A" # -A option to speed up mysql load } @@ -1033,7 +1030,7 @@ mysql () # @param $1 filename of backup file. Should be inside project root mysql_import () { - if is_yml_absent ; then return 2; fi + check_docker_running if ! get_drush_path; then return; fi local confirm=1 @@ -1099,7 +1096,7 @@ mysql_import () # @param $1 type of cache to clean (all, css-js, ...) clear_cache () { - if is_yml_absent ; then return 2; fi + check_docker_running #if ! get_drush_path; then return; fi local type='all' if [[ ! "$1" == "" ]]; then @@ -1113,7 +1110,7 @@ clear_cache () # @param $* arguments and params passed to Behat behat () { - if is_yml_absent ; then return 2; fi + check_docker_running local params='' local path='tests/behat' for i in "$@"; do @@ -1170,11 +1167,11 @@ exec_url () # @param $1 $2... container names remove () { + check_docker_running if [[ $1 == "" ]]; then _confirm "[!] This will delete all project containers including the DB one. You will have to re-import DB."; fi - if is_yml_absent ; then return 2; fi if is_vagrant ; then if ! is_docker_running; then echo-green "dsh: Starting vagrant vm..." @@ -1184,10 +1181,10 @@ remove () started=0 fi - if [ $started -eq 0 ] && is_docker_compose ; then + if [ $started -eq 0 ] ; then _remove_containers $* fi - elif ( is_boot2docker || is_linux ) && is_docker_compose ; then + elif ( is_boot2docker || is_linux ) ; then _remove_containers $* fi } From 210f51e3bcf0b9e8ea98e3bdbe2c6b2377742269 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Wed, 20 Apr 2016 16:22:26 -0400 Subject: [PATCH 07/11] Mega refactoring: run, drush and is_tty Forcing the use of winpty (console) on Windows for interactive sessions. --- bin/dsh | 138 ++++++++++++++++++++++++++------------------------------ 1 file changed, 63 insertions(+), 75 deletions(-) diff --git a/bin/dsh b/bin/dsh index e2972ba..5acff0c 100755 --- a/bin/dsh +++ b/bin/dsh @@ -1,6 +1,6 @@ #!/bin/bash -DSH_VERSION=1.12.12 +DSH_VERSION=1.12.13 # Console colors red='\033[0;31m' @@ -269,12 +269,6 @@ is_tty () return 1; fi - # disable interactive shell on windows for now - # known Docker issue: https://github.com/docker/docker/issues/12469 - if is_windows; then - return 1; - fi - [[ "$(/usr/bin/tty || true)" != "not a tty" ]] } @@ -282,7 +276,7 @@ is_tty () testing_warn () { - if ! ( is_tty || is_windows ); then return; fi + if ! is_tty; then return; fi if [[ ! $B2D_BRANCH == 'master' ]] || [[ ! $DRUDE_BRANCH == 'master' ]]; then echo-yellow "dsh: boot2docker - ${B2D_BRANCH}, drude - ${DRUDE_BRANCH}" fi @@ -347,7 +341,7 @@ check_yml() _confirm () { # Skip checks if not running interactively (not a tty or not on Windows) - if ! ( is_tty || is_windows ); then return 0; fi + if ! is_tty; then return 0; fi while true; do read -p "$1 [y/n]: " answer @@ -836,7 +830,7 @@ update_images () update_boot2docker () { testing_warn - if ! ( is_tty || is_windows ); then + if ! is_tty; then echo "'update' is not allowed in a non-interactive environment." return 1 fi @@ -936,85 +930,83 @@ update_dsh () exit } -# Start interactive bash in container -# @param $1 container name (defaults to cli) +# Start an interactive bash session in a container +# @param $1 container name _bash () { # Interactive shell requires a tty. # On Windows we assume we run interactively via winpty (console.exe). - if ! ( is_tty || is_windows ); then + if ! is_tty; then echo "Interactive bash console in a non-interactive enveronment!? Nope, won't happen." return 1 fi - if is_docker && is_docker_compose ; then - check_docker_running - local container_name - if [[ "$1" == "" ]]; then - container_name='cli' - else - container_name="$1" - fi - local container_id - container_id=$(get_container_id $container_name) - # Running docker exec interactively on Windows requires workarounds - if is_windows; then - # Workaround 1 - run docker exec via winpty (console.exe) to get a tty console in cygwin. - if is_binary_found 'console'; then - console docker exec -it $container_id bash -i - # Workaround 2 - run docker exec via `vagrant ssh -c` - else - # Drop /cygdrive prefix if the working directory is opened as /cygdrive//.. instead of /.. - cwd=$(pwd); cwd=${cwd#/cygdrive} - command="cd $cwd && docker exec -it $container_id bash -i"; - vagrant ssh -c "$command" - fi - # Run docker exec interactively directly if not on Windows - else - docker exec -it $container_id bash -i - fi - fi + # Pass container name to _run + CONTAINER_NAME=$1 _run bash -i } -# Run a command in the cli container in the project root +# Run a command in the cli container changing dir to the same folder # @param $* command with it's params to run -run () +_run () { check_docker_running - if is_tty ; then - # need to use $* here to finally resolve slash-escaped string if any. - # passing $@ will not work properly if $@ contains slash espaped string from drush command - docker exec -it $container_id bash -ic "$*" + if [[ "$CONTAINER_NAME" == "" ]]; then CONTAINER_NAME='cli'; fi + container_id=$(get_container_id $CONTAINER_NAME) + + # 1) $winpty_cmd + local winpty_cmd + # Running docker exec interactively on Windows requires workarounds + if is_windows; then + # Workaround - run docker exec via winpty (console.exe) to get a tty console in cygwin. + if is_binary_found 'console'; then + winpty_cmd='console' else - docker exec $container_id bash -c "$*" + echo-red 'Winpty (console.exe) binary missing.' + echo 'Run "dsh install prerequisites" to install it.' + exit 1 fi fi -} -# Run a command in the cli container changing dir to the same folder -# @param $* command with it's params to run -_run () -{ - #get client window width for interactive sessions - local COLS='' - if is_tty ; then - COLS=$(tput cols) - fi + # 2) cmd + local cmd - if is_yml_absent ; then return 2; fi - if is_docker && is_docker_compose ; then - local path=$(get_current_relative_path) - local cd='' + local cdir + if [[ $CONTAINER_NAME == "cli" ]]; then #only chdir to the same dir in cli container + local path + path=$(get_current_relative_path) if [[ "$path" != "$(pwd)" ]] && [[ "$path" != "" ]] ; then - # if we're not outside project folder - cd="cd $path &&" + # we're inside docroot + cdir="cd $path &&" fi if [[ "$path" == "" ]] ; then - # if we're on project folder level (outside docroot) - cd="cd docroot &&" + # we're on project folder level (outside docroot) + cdir="cd docroot &&" + fi + fi + + local columns + if is_tty ; then + columns="export COLUMNS=$(tput cols) &&" + fi + + cmd="$cdir $columns" + + # 3) convert array of parameters into escaped string + # Escape spaces that are "spaces" and not parameter delimeters (i.e. param1 param2\ with\ spaces param3) + cmd="$cmd "$(printf " %q" "$@") + + # 4) execute + if is_tty ; then + # interactive + if [[ $1 == "" ]]; then + $winpty_cmd docker exec -it $container_id bash -i + else + $winpty_cmd docker exec -it $container_id bash -ic "$cmd" fi - run "$cd export COLUMNS=$COLS && $@" + else + # non-interactive + docker exec $container_id bash -c "$cmd" fi } @@ -1065,7 +1057,7 @@ mysql_import () echo "Importing $filename into the database..." # Use pv for interactive shells only. - if is_tty ; then + if is_tty && ! is_windows ; then # Check if we have a gzipped dump and treat it differently. if [[ $filename == *.gz ]]; then file_size=$(gzip -l $1 | sed -n 2p | awk '{print $2}') @@ -1301,11 +1293,11 @@ case $1 in ;; exec) shift - _run "$*" + _run "$@" ;; run) shift - _run "$*" + _run "$@" ;; mysql) mysql @@ -1327,9 +1319,7 @@ case $1 in if [[ $1 == "" ]]; then _run drush else - # slash escape space-delimited parameters for safe passing between functions - cmd=$(printf " %q" "$@") - _run drush $cmd + _run drush "$@" fi ;; drupal) @@ -1337,9 +1327,7 @@ case $1 in if [[ "$1" == "" ]]; then _run drupal else - # slash escape space-delimited parameters for safe passing between functions - cmd=$(printf " %q" "$@") - _run drupal $cmd + _run drupal "$@" fi ;; behat) From 08d4402f09806336a835041308f35240b74011b8 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Wed, 20 Apr 2016 17:27:45 -0400 Subject: [PATCH 08/11] Use 0/1 instead of true/false --- bin/dsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/dsh b/bin/dsh index 5acff0c..bb37fd8 100755 --- a/bin/dsh +++ b/bin/dsh @@ -116,7 +116,7 @@ clean_string () get_mysql_connect () { # Run drush forcing tty to false to avoid colored output string from drush. - echo "$(DRUDE_IS_TTY=false _run drush sql-connect)" + echo "$(DRUDE_IS_TTY=0 _run drush sql-connect)" } # Use this function for every docker-compose invocation. @@ -262,10 +262,10 @@ is_docker_running () is_tty () { # Override option via $DRUDE_IS_TTY (true|false) env variable. - if [[ $DRUDE_IS_TTY == 'true' ]]; then + if [[ $DRUDE_IS_TTY == 1 ]]; then return 0; fi - if [[ $DRUDE_IS_TTY == 'false' ]]; then + if [[ $DRUDE_IS_TTY == 0 ]]; then return 1; fi From 034a6b48b9cf85ef246816944a3eccbc6c01a922 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Wed, 20 Apr 2016 17:29:21 -0400 Subject: [PATCH 09/11] Refactor mysql_import to work with the new _run command --- bin/dsh | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/bin/dsh b/bin/dsh index bb37fd8..b00599a 100755 --- a/bin/dsh +++ b/bin/dsh @@ -972,7 +972,9 @@ _run () local cmd local cdir - if [[ $CONTAINER_NAME == "cli" ]]; then #only chdir to the same dir in cli container + # Only chdir to the same dir in cli container + # RUN_NO_CDIR can be used to override this (used in mysql_import) + if [[ $CONTAINER_NAME == "cli" ]] && [[ $RUN_NO_CDIR != 1 ]]; then local path path=$(get_current_relative_path) if [[ "$path" != "$(pwd)" ]] && [[ "$path" != "" ]] ; then @@ -994,8 +996,13 @@ _run () # 3) convert array of parameters into escaped string # Escape spaces that are "spaces" and not parameter delimeters (i.e. param1 param2\ with\ spaces param3) - cmd="$cmd "$(printf " %q" "$@") - + if [[ $2 != "" ]]; then + cmd="$cmd "$(printf " %q" "$@") + # Do not escape spaces if there is only one parameter (e.g. dsh run "ls -la | grep txt") + else + cmd="$cmd $@" + fi + # 4) execute if is_tty ; then # interactive @@ -1049,38 +1056,36 @@ mysql_import () _confirm "[!] This will drop the existing database. Continue?" fi - check_docker_running - - _run drush sql-drop -y + #_run drush sql-drop -y local sql_connect sql_connect=$(get_mysql_connect) echo "Importing $filename into the database..." # Use pv for interactive shells only. - if is_tty && ! is_windows ; then + if is_tty ; then # Check if we have a gzipped dump and treat it differently. if [[ $filename == *.gz ]]; then file_size=$(gzip -l $1 | sed -n 2p | awk '{print $2}') - run "zcat ./$pathdiff/$filename | pv --size $file_size | "$sql_connect + RUN_NO_CDIR=1 _run "zcat ./$pathdiff/$filename | pv --size $file_size | $sql_connect" else - run "pv ./$pathdiff/$filename | "$sql_connect + RUN_NO_CDIR=1 _run "pv ./$pathdiff/$filename | $sql_connect" fi else # Check if we have a gzipped dump and treat it differently. if [[ $filename == *.gz ]]; then - run "zcat ./$pathdiff/$filename | "$sql_connect + RUN_NO_CDIR=1 _run "zcat ./$pathdiff/$filename | $sql_connect" else - run "cat ./$pathdiff/$filename | "$sql_connect + RUN_NO_CDIR=1 _run "cat ./$pathdiff/$filename | $sql_connect" fi fi # Check if import succeded or not and print results. if [ $? -eq 0 ]; then echo-green "dsh: mysql-import finished"; - _notify "Dsh" "Mysql import finished" + if is_tty; then _notify "Dsh" "Mysql import finished"; fi else echo-red "dsh: mysql-import failed"; - _notify "Dsh" "Mysql import failed!" + if is_tty; then _notify "Dsh" "Mysql import failed!"; fi fi } From 0cd964fcea74c0cffc5e1f9b78353e7c5348f6d0 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Wed, 20 Apr 2016 17:29:48 -0400 Subject: [PATCH 10/11] dsh version bump to 1.12.14 --- bin/dsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/dsh b/bin/dsh index b00599a..d364957 100755 --- a/bin/dsh +++ b/bin/dsh @@ -1,6 +1,6 @@ #!/bin/bash -DSH_VERSION=1.12.13 +DSH_VERSION=1.12.14 # Console colors red='\033[0;31m' From 91f1e59149615a6bb84706f3b087955d175f21ae Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Thu, 21 Apr 2016 15:03:47 -0400 Subject: [PATCH 11/11] Version bump and release notes --- CHANGELOG.md | 14 ++++++++++++++ VERSION | 2 +- bin/dsh | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bad8e4..e37a1d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 1.3.1 (2016-04-21) + +- A lot of refactoring to bring interactive shell experience to Windows (via winpty, which is a requirement now on Windows) + - `dsh update boot2docker` will now ask for a confirmation + - `dsh exec` (`dsh run`) can now run interactive commands (try `dsh exec top`) + - `dsh bash` now longer relies on `vagrant ssh -c` and thus launches much faster + - `dsh mysql-import` now disaplays a progress via `pv` (same as on Mac/Linux) +- Fixed `dsh bash`regression from v1.3.0 on Mac/Linux +- Documentation fixes and updates + +A full update is recommended. Please follow the updates instructions: +https://github.com/blinkreaction/drude#updates + + ## 1.3.0 (2016-04-15) - Implement dsh drupal shortcut for Drupal Console commands diff --git a/VERSION b/VERSION index 589268e..6261a05 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.0 \ No newline at end of file +1.3.1 \ No newline at end of file diff --git a/bin/dsh b/bin/dsh index d364957..f67e2e6 100755 --- a/bin/dsh +++ b/bin/dsh @@ -1,6 +1,6 @@ #!/bin/bash -DSH_VERSION=1.12.14 +DSH_VERSION=1.13.0 # Console colors red='\033[0;31m'