github.com/vulppine/fotoDen@v0.3.0/fotoDen-test.sh (about) 1 #!/bin/bash 2 3 if [ "$1" == "" ]; then 4 echo "fotoDen test environment script" 5 echo -ne "\n" 6 echo "build : builds fotoDen in the current folder (requires this to be in the same directory as the source)" 7 echo "mk-testdir : creates the fotoDen test directory" 8 echo "mk-container : makes a NGINX container (requires docker and sudo)" 9 echo "run-container : runs the fotoDen-test container with the fotoDen_test folder mounted (expects a nginx container, requires sudo)" 10 echo "rm-container : removes the fotoDen-test container (requires sudo)" 11 echo "mkall : makes everything" 12 exit 0 13 fi 14 15 if [ "$1" == "build" ] || [ "$1" == "mkall" ]; then 16 make all 17 fi 18 19 if [ "$1" == "mk-testdir" ] || [ "$1" == "mkall" ]; then 20 mkdir fotoDen_test 21 22 fotoDen=$PWD'/build/fotoDen --config-dir fotoDen_test/' 23 24 # $fotoDen init js build/fotoDen.min.js 25 # unzip build/default_theme.zip -d build/theme/ 26 $fotoDen init site --name "Test Site" -v --url "http://localhost" --theme Default fotoDen_test/test_root 27 $fotoDen create folder --name "Test Folder" -v fotoDen_test/test_root/test_folder 28 $fotoDen create album --name "Test Album" -v test_images fotoDen_test/test_root/test_folder/test_album 29 30 echo "---------------------------------------------------" 31 echo "Your test environment is available at fotoDen_test." 32 echo "---------------------------------------------------" 33 fi 34 35 if [ "$1" == "run-container" ]; then 36 sudo docker run --name fotoDen-test -v $PWD/fotoDen_test/test_root:/usr/share/nginx/html:ro -p 80:80 -d nginx:alpine 37 elif [ "$1" == "rm-container" ]; then 38 sudo docker rm -f fotoDen-test 39 elif [ "$1" == "mk-container" ] || [ "$1" == "mkall" ]; then 40 read -n 1 -p "Would you like to make a NGINX container? (requires sudo) [y] " choice 41 echo "" 42 43 if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then 44 sudo docker run --name fotoDen-test -v $PWD/fotoDen_test/test_root:/usr/share/nginx/html:ro -p 80:80 -d nginx:alpine 45 echo "Access the test environment on http://localhost:80. Stop the environment by running docker stop fotoDen-test." 46 fi 47 fi