aboutsummaryrefslogtreecommitdiff
path: root/dev/dist.sh
blob: 870f3e20c118c195e3464bcd36f3e49648dc1427 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env bash

# USAGE:  dev/dist.sh ttyponies
#     or  dev/dist.sh pdfmanual
#     or  dev/dist.sh tag VERSION [OTHER OPTIONS FOR `git tag`]


ttyponies()
{
    mkdir -p "ttyponies"
    for pony in $(ls --color=no "ponies/"); do
	if [ ! "$pony" = '.info' ]; then
	    echo "building ttypony: $pony"
	    if [ "`readlink "ponies/$pony"`" = '' ]; then
	        ponysay2ttyponysay < "ponies/$pony" | tty2colourfultty -c 1 > "ttyponies/$pony"
	        git add "ttyponies/$pony"
	    else
		ln -sf `readlink "ponies/$pony"` "ttyponies/$pony"
		git add "ttyponies/$pony"
	    fi
	fi
    done
    mkdir -p "extrattyponies"
    for pony in $(ls --color=no "extraponies/"); do
	if [ ! "$pony" = '.info' ]; then
	    echo "building extrattypony: $pony"
	    if [ "`readlink "extraponies/$pony"`" = '' ]; then
	        ponysay2ttyponysay < "extraponies/$pony" | tty2colourfultty -c 1 > "extrattyponies/$pony"
	        git add "extrattyponies/$pony"
	    else
                ln -sf `readlink "extraponies/$pony"` "extrattyponies/$pony"
		git add "extrattyponies/$pony"
	    fi
	fi
    done
}


pdfmanual()
{
    texi2pdf "manuals/ponysay.texinfo"
    for ext in `echo aux cp cps fn ky log pg toc tp vr op ops pgs vrs bak`; do
	if [ -f "ponysay.$ext" ]; then
	    unlink "ponysay.$ext"
	fi
    done
    if [ -d "ponysay.t2d" ]; then
	rm -r "ponysay.t2d";
    fi
    pdfjam --pagecolor 249,246,240 -o "ponysay.pdf" "ponysay.pdf"
    git add  "manuals/ponysay.texinfo" "ponysay.pdf"
}


pdf()
{
    pdfmanual "$@"
}


tag()
{
    version=`./setup.py version`
    if [ "$version" = 'Ponysay '"$1"' installer' ]; then
	git tag -a "$@" && git checkout "$1" && git push -u origin "$1"
    else
	echo 'Setup script reports. '"$version"
	echo 'This is not consistent with desired tag version: '"$1"
	echo 'Make sure the version is correct in setup.py and that all change logs are up to date'
    fi
}


[ "$1" = './dist.sh' ] && cd ..
"$@"