File tree Expand file tree Collapse file tree 1 file changed +21
-5
lines changed
Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
2- if ! which inotifywait > /dev/null 2>&1 ; then
3- echo " Error: the inotifywait command is not available. Make sure you have inotify-tools installed."
4- exit 1
2+
3+ # Check for the fswatch command
4+ if ! command -v fswatch > /dev/null 2>&1 ; then
5+ echo " Error: The fswatch command is not available."
6+ echo " On macOS, you can install it with Homebrew: brew install fswatch"
7+ exit 1
58fi
69
10+ cd " $( git rev-parse --show-toplevel) "
11+
712while true ; do
813 echo " Waiting for a change in the plugins directory..."
9- output=$( inotifywait -e modify,create,delete -r ./plugins --include ' .*(\.php$|/tests/.*)' 2> /dev/null)
10- plugin_slug=$( echo " $output " | awk -F/ ' {print $3}' )
14+
15+ file=$( fswatch -1 -r \
16+ --event Created \
17+ --event Updated \
18+ --event Removed \
19+ --include ' \.php$' \
20+ --include ' /tests/' \
21+ ./plugins 2> /dev/null | head -n 1)
22+
23+ # Make the file path relative.
24+ file=" ${file# " $PWD /" } "
25+
26+ plugin_slug=$( echo " $file " | awk -F/ ' {print $2}' )
1127 sleep 1 # Give the user a chance to copy text from terminal before IDE auto-saves.
1228 clear
1329 echo " Running phpunit tests for $( tput bold) $plugin_slug $( tput sgr0) :"
You can’t perform that action at this time.
0 commit comments