summaryrefslogtreecommitdiff
path: root/actions.sh
blob: c8636bcee27d11763146d465af221f9878ffc6f9 (plain)
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
#!/usr/bin/env sh

set -euC

run_tests () {
    eval "prove -l ${1-} t/"
}

foreground () {
    script/jwebmail daemon
}

start_dev () {
    MOJO_MODE=development hypnotoad script/jwebmail
}

stop_dev () {
    MOJO_MODE=development hypnotoad -s script/jwebmail
}

logrotate () {
    mode=${1:-development}
    mv -i "log/$mode.log" "log/${mode}_$(date --iso-8601=minutes).log"
}

linelength () {
    files=${1:-'README.md CHANGES LICENSE'}
    for file in $files
    do
        fold -s -w 85 "$file" | diff "$file" -
    done
}

follow () {
    mode=${1:-development}
    tail -f "log/$mode.log"
}

check_manifest () {
    perl -nE 'chomp; say unless -e' MANIFEST
}

cmd=$1
shift
if [ "$(command -v "$cmd")" = "$cmd" ]
then eval "$cmd" "$@"
else echo "unkown commad '$cmd'"; exit 1
fi