Skip to content

Instantly share code, notes, and snippets.

@jakzal
Last active October 1, 2015 20:24
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jakzal/9229919 to your computer and use it in GitHub Desktop.
Save jakzal/9229919 to your computer and use it in GitHub Desktop.
Run commands on a Vagrant VM
#!/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