forked from mozilla/mig
-
Notifications
You must be signed in to change notification settings - Fork 1
/
inotify_make.sh
executable file
·64 lines (53 loc) · 1.82 KB
/
inotify_make.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
# Julien Vehent - 2014
# watch the MIG source code directory and rebuild the components
# when a file is saved.
echo "starting inotify listener on ./src/mig"
# feed the inotify events into a while loop that creates
# the variables 'date' 'time' 'dir' 'file' and 'event'
inotifywait -mr --timefmt '%d/%m/%y %H:%M' --format '%T %w %f %e' \
-e modify ./src/mig \
| while read date time dir file event
do
if [[ "$file" =~ \.go$ && "$dir" =~ src\/mig ]]; then
dontskip=true
else
#echo skipping $date $time $event $dir $file
continue
fi
#echo NEW EVENT: $event $dir $file
if [[ "$dir" =~ src\/mig\/$ ]]; then
echo
make mig-agent && \
make mig-action-generator && \
make mig-action-verifier && \
make mig-api && \
make mig-scheduler && \
echo success $(date +%H:%M:%S)
elif [[ "$dir" =~ agent && "$file" != "configuration.go" ]] ; then
echo
make mig-agent && echo success $(date +%H:%M:%S)
elif [[ "$dir" =~ modules && "$file" != "configuration.go" ]] ; then
echo
make mig-agent && echo success $(date +%H:%M:%S)
elif [[ "$dir" =~ api ]] ; then
echo
make mig-api && echo success $(date +%H:%M:%S)
elif [[ "$dir" =~ generator ]] ; then
echo
make mig-action-generator && echo success $(date +%H:%M:%S)
elif [[ "$dir" =~ verifier ]] ; then
echo
make mig-action-verifier && echo success $(date +%H:%M:%S)
elif [[ "$dir" =~ pgp ]] ; then
echo
make mig-agent && \
make mig-action-generator && \
make mig-action-verifier && \
make mig-api && \
echo success $(date +%H:%M:%S)
elif [[ "$dir" =~ scheduler ]] ; then
echo
make mig-scheduler && echo success $(date +%H:%M:%S)
fi
done