File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,12 +22,18 @@ if [ "$1" = '-h' ]; then
2222 usage
2323fi
2424
25- echo " @TODO: WIP"
26- exit 1
27-
28-
29- if mount | grep -q ' ^/vagrant' ; then
25+ VAGRANT_EXEC=$( which vagrant )
26+ VAGRANT_PRESENT=$?
27+ if [ $VAGRANT_PRESENT -eq 0 ] && ! mount | grep -q ' ^/vagrant' ; then
28+ echo ' ## Running command in vagrant.'
3029 vagrant ssh -c " cd /vagrant; $@ "
3130else
31+ echo ' ## Running command natively.'
3232 eval " $@ "
3333fi
34+
35+ # Logic matrix:
36+ # vagrant installed + outside vm (no /vagrant mount point) = run in vagrant
37+ # vagrant installed + inside vm = run native
38+ # no vagrant + outside vm = run native
39+ # no vagrant + inside vm = run native
Original file line number Diff line number Diff line change 3939fi
4040
4141bin/clear-cache
42- if mount | grep -q ' ^/vagrant' ; then
43- Console/cake test app $TESTCASE --configuration=" ${PHPUNIT_CONFIG} " " $@ "
44- else
45- vagrant ssh -c " cd /var/www; Console/cake test app $TESTCASE --configuration=" ${PHPUNIT_CONFIG} " " $@ " "
46- fi
42+ bin/run-in-vagrant " Console/cake test app $TESTCASE --configuration=" ${PHPUNIT_CONFIG} " " $@ " "
You can’t perform that action at this time.
0 commit comments