Skip to content

Instantly share code, notes, and snippets.

@baruica
Forked from jakzal/vm.sh
Created March 4, 2014 12:39
Show Gist options
  • Save baruica/9345756 to your computer and use it in GitHub Desktop.
Save baruica/9345756 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