blob: 8282b44f46b5115682297edd2cc8dcb1997bb6d0 (
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
#!/bin/sh
# Read README.txt first.
# jpokorny@redhat.com
#
# helpers
#
announce () {
# use colours if available
echo
if test -t 1; then
echo -en "\\033[32m"
echo -n "$1"
echo -e "\\033[0m"
else
echo "[[ $1 ]]"
fi
}
do_del () {
#echo "delete $1?"
[ -d "$1" ] && rm -rfI -- "$1" || echo "$1 not present"
}
do_wget () {
# usage: $1 = action, $2 = target dir, $2..n = actual arguments to wget
if [ $# -le 2 ]; then
echo "do_wget: not enough arguments"
exit 2
fi
if [ "$(dirname $2)" == "." ]; then
toplevel="$2"
else
toplevel="$(dirname $2)"
fi
announce "$1 $toplevel (wget)"
if [ "$1" == "get" ]; then
wget -nv -P "$2" "${@:3}" 2>&1
else
do_del "$toplevel"
fi
ret=$?
[ $ret -ne 0 ] && announce "action failed with exit status $?"
return $ret
}
git_init_submodule () {
# usage: $1 = action, $2..n submodules
ret=0
for submodule in "${@:2}"; do
announce "$1 $submodule (git submodule)"
if [ "$1" == "get" ]; then
git submodule update --init "$submodule" 2>&1
else
do_del "$submodule"
fi
ret=$?
[ $ret -ne 0 ] && break
done
[ $ret -ne 0 ] && announce "action failed with exit status $?"
return $ret
}
#
# categories of plugins + recipes to get them
#
common () {
announce "--- common ---"
# local_vimrc:
# directory-local settings applied to contained files
LOCAL_VIMRC_DIR="local-vimrc"
LOCAL_VIMRC_URL="http://lh-vim.googlecode.com/svn/misc/trunk/plugin/local_vimrc.vim"
# "plugin" directory has to be added (downloading recursively
# the whole original "plugin" path for one file is impractical)
do_wget $1 "$LOCAL_VIMRC_DIR/plugin" -nc "$LOCAL_VIMRC_URL"
}
python () {
announce "--- python ---"
# Python-mode:
# integrates pylint, rope, pydoc, pyflakes
# + extra highlighting, whitespace removal ...
git_init_submodule $1 "git-python-mode"
}
tg2 () {
announce "--- tg2 ---"
# genshi-contrib:
# from genshi svn, contrib/vim
# TODO: is there a less complicated way to get these files?
GENSHI_CONTRIB_DIR="genshi-contrib"
GENSHI_CONTRIB_URL="http://svn.edgewall.org/repos/genshi/contrib/vim/"
do_wget $1 "$GENSHI_CONTRIB_DIR" -nc -e robots=off -r -l3 -np -nH --cut-dirs=4 -R index.html "$GENSHI_CONTRIB_URL"
}
web () {
announce "--- web ---"
# empty for now
}
optional () {
announce "--- optional ---"
# makegreen:
# test results integration
# Tagbar (possible alternative TagList):
# "code navigator" incl. JS support if jsctags installed
git_init_submodule $1 "git-makegreen" "git-tagbar"
}
#
# go
#
main () {
action="get"
if [ "$1" == "get" -o "$1" == "del" ]; then
action="$1"
shift
fi
while [ -n "$1" ]; do
case "$1" in
common|python|tg2|web|optional)
$1 $action || exit $?
shift;;
all)
main $action common python tg2 web optional
break;;
help|*)
echo "usage: ./init.sh [del] (common|python|tg2|web|optional|all)+"
break;;
esac
done
}
if [ $# -eq 0 ]; then
main help
else
main "$@"
fi
|