Last active
September 24, 2024 14:47
-
-
Save jakzal/9229919 to your computer and use it in GitHub Desktop.
Run commands on a Vagrant VM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
VM_PROJECT_DIR="/home/vagrant/project" | |
COMMAND="$1" | |
shift | |
run() { | |
vagrant ssh -c "cd $VM_PROJECT_DIR ; $*" | |
} | |
cs() { | |
run bin/php-cs-fixer fix src "$@" | |
run bin/php-cs-fixer fix --level=all --fixers=-unused_use features "$@" | |
run bin/php-cs-fixer fix --level=all --fixers=-visibility,-unused_use spec "$@" | |
} | |
phpspec() { | |
run bin/phpspec run --ansi "$@" | |
} | |
behat() { | |
run "bin/behat --ansi $*" | |
} | |
help() { | |
USAGE="$0 "$(compgen -A function | tr "\\n" "|" | sed 's/|$//') | |
echo $USAGE | |
} | |
if [ "$(type -t $COMMAND)" != "function" ]; then | |
help | |
exit 1 | |
fi | |
$COMMAND |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment