From a0f1d39ce42e6cb3f1fff618cf1c4552ffdaf3b9 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 16:03:33 -0400 Subject: [PATCH] added bash option --- sync.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sync.sh b/sync.sh index d48eb18c..4dec67a7 100755 --- a/sync.sh +++ b/sync.sh @@ -1,5 +1,19 @@ #!/bin/bash +# This shell script is an optional tool to simplify +# the installation and usage of laradock with docker-sync. + +# To run, make sure to add permissions to this file: +# chmod 755 sync.sh + +# Usage: +# Install docker-sync: ./sync.sh install +# Start workspace with nginx and mysql: ./sync.sh up nginx mysql +# Open bash inside the workspace: ./sync.sh bash +# Stop workspace: ./sync.sh down +# Force sync: ./sync.sh trigger +# Clean synced files: ./sync.sh clean + # prints colored text print_style () { @@ -26,6 +40,7 @@ display_options () { print_style " install" "success"; printf "\t\t Installs docker-sync gem on the host machine.\n"; print_style " up [services]" "success"; printf "\t Starts docker-sync and runs docker compose.\n"; print_style " down" "success"; printf "\t\t\t Stops containers and docker-sync.\n"; + print_style " bash" "success"; printf "\t\t\t Opens bash on the workspace\n"; print_style " trigger" "success"; printf "\t\t Manually triggers the synchronization of files.\n"; print_style " clean" "warning"; printf "\t\t Removes all files from the docker-sync container.\n"; } @@ -56,6 +71,9 @@ elif [ "$1" == "install" ]; then print_style "Installing docker-sync\n" "info"; gem install docker-sync; +elif [ "$1" == "bash" ]; then + docker-compose exec workspace bash; + elif [ "$1" == "trigger" ]; then print_style "Manually triggering sync between host and docker-sync container.\n" "info"; docker-sync sync; @@ -64,6 +82,7 @@ elif [ "$1" == "clean" ]; then print_style "Removing and cleaning up files from the docker-sync container.\n" "warning"; docker-sync clean; + else print_style "Invalid arguments.\n" "danger"; display_options;