#!/bin/bash function tidy { rm -vf {./,tests/,src/{./,AntiCSRF/,Clock/,Hash/,Request/,Required/,RFC/,Session/,URI/,Workflow/}}*~ rm -vf {./,tests/,src/{./,AntiCSRF/,Clock/,Hash/,Request/,Required/,RFC/,Session/,URI/,Workflow/}}#*# } function clean { if [[ ! -d "vendor/" ]]; then echo "No vendor/ folder to remove." else echo "Removing ./vendor/ ..." rm -rf "vendor/" echo "Done" fi rm -fv "composer.lock" } function update { composer update composer dumpautoload -v } if [[ $# -ne 1 ]]; then echo "This script requires a verb." echo "VERBS:" echo " update - Update dependencies with composer" echo " test - If no vendor/ folder Update, then run phpunit tests." echo " clean - Remove all buildfiles and editor artifacts." echo " tidy - Remove all editor artifacts." fi cmd=$1 if [[ $cmd == "update" ]]; then update elif [[ $cmd == "test" ]]; then if [[ ! -d "vendor/" ]]; then update fi ./vendor/bin/phpunit --testdox tests elif [[ $cmd == "tidy" ]]; then tidy elif [[ $cmd == "clean" ]]; then tidy && clean else echo "Unrecognized verb: ${cmd}" fi