summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2012-02-09 17:16:50 +0100
committerJan Pokorný <jpokorny@redhat.com>2012-02-09 17:16:50 +0100
commit735350448122b250c74eee1684c0637fdc2deaa6 (patch)
tree23ff53751158e893d2a7c1f124c6d2368f6e8891
parente5fd48691defc1cda3e571aea4ca45ba7f377262 (diff)
downloadvim4projects-735350448122b250c74eee1684c0637fdc2deaa6.tar.gz
vim4projects-735350448122b250c74eee1684c0637fdc2deaa6.tar.xz
vim4projects-735350448122b250c74eee1684c0637fdc2deaa6.zip
update init*
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rw-r--r--init-common2
-rw-r--r--init-optional2
-rw-r--r--init-python2
-rw-r--r--init-tg22
-rwxr-xr-xinit.sh48
5 files changed, 34 insertions, 22 deletions
diff --git a/init-common b/init-common
index f5cec4a..2786636 100644
--- a/init-common
+++ b/init-common
@@ -9,6 +9,6 @@ common () {
# "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" "$LOCAL_VIMRC_URL"
- do_wget $1 "$LOCAL_VIMRC_DIR/autoload/lh" "$LH_COMMON_URL"
+ do_wget $1 "$LOCAL_VIMRC_DIR/autoload/lh" "$LH_COMMON_URL" || return $?
}
register common
diff --git a/init-optional b/init-optional
index a36e50e..42ec78a 100644
--- a/init-optional
+++ b/init-optional
@@ -5,6 +5,6 @@ optional () {
# test results integration
# Tagbar (possible alternative TagList):
# "code navigator" incl. JS support if jsctags installed
- do_git_submodule $1 "git-makegreen" "git-tagbar"
+ do_git_submodule $1 "git-makegreen" "git-tagbar" || return $?
}
register optional
diff --git a/init-python b/init-python
index 77b1dca..a9e245e 100644
--- a/init-python
+++ b/init-python
@@ -4,6 +4,6 @@ python () {
# Python-mode:
# integrates pylint, rope, pydoc, pyflakes
# + extra highlighting, whitespace removal ...
- do_git_submodule $1 "git-python-mode"
+ do_git_submodule $1 "git-python-mode" || return $?
}
register python
diff --git a/init-tg2 b/init-tg2
index 90ef375..16f3605 100644
--- a/init-tg2
+++ b/init-tg2
@@ -6,6 +6,6 @@ tg2 () {
GENSHI_CONTRIB_DIR="genshi-contrib"
GENSHI_CONTRIB_SVN="http://svn.edgewall.org/repos/genshi/contrib/vim/"
# no need for specific revision
- do_svn $1 "$GENSHI_CONTRIB_DIR" "$GENSHI_CONTRIB_SVN"
+ do_svn $1 "$GENSHI_CONTRIB_DIR" "$GENSHI_CONTRIB_SVN" || return $?
}
register tg2
diff --git a/init.sh b/init.sh
index b72b768..094ca2d 100755
--- a/init.sh
+++ b/init.sh
@@ -6,27 +6,32 @@
# internals
#
-CLR_OK=32
+CLR_USR=34
+CLR_SCR=32
CLR_BAD=31
CLR_WRN=33
+RET_DEL=64
+
CHOICES=""
check_nargs () {
[ $1 -ge $2 ]
ret=$?
- [ $ret -eq 0 ] || announce "action failed (expected $1+ args, got $2)" $CLR_BAD
+ [ $ret -eq 0 ] || do_announce "action failed (expected $1+ args, got $2)" $CLR_BAD
return $ret
}
check_ret () {
- [ $1 -ne 0 ] && announce "action failed with exit status $1" $CLR_BAD
+ [ $1 -ne 0 -a $1 -ne $RET_DEL ] \
+ && do_announce "action failed with exit status $1" $CLR_BAD
return $1
}
do_del () {
#echo "delete $1?"
- [ -d "$1" ] && rm -rfI -- "$1" || announce "$1 not present" $CLR_WRN
+ [ -d "$1" ] && rm -rfI -- "$1" || do_announce "$1 not present" $CLR_WRN
+ return $RET_DEL
}
do_announce () {
@@ -36,7 +41,7 @@ do_announce () {
if test -t 1; then
colour=$2
if [ -z "$colour" ]; then
- colour=$CLR_OK
+ colour=$CLR_USR
fi
echo -en "\\033[${colour}m"
echo -n "$1"
@@ -79,16 +84,23 @@ do_git_submodule () {
ret=0
git_prefix=$(git rev-parse --show-prefix)
for submodule in "${@:2}"; do
- announce "$1 $submodule (git submodule)" delimit
+ do_announce "$1 $submodule (git submodule)" $CLR_SCR delimit
if [ "$1" == "get" ]; then
- pushd "$(git rev-parse --show-toplevel)" 2>/dev/null
- git submodule update --init --recursive "${git_prefix}${submodule}" 2>&1
- popd 2>/dev/null
+ pushd "$(git rev-parse --show-toplevel)" >/dev/null
+ # TODO: --recursive seems to be buggy?
+ git submodule update --init "${git_prefix}${submodule}" 2>&1
+ ret=$?
+ popd >/dev/null
+ if [ $ret -eq 0 ]; then
+ pushd $submodule >/dev/null
+ git submodule update --init 2>&1
+ popd >/dev/null
+ fi
else
- do_del "$submodule" && return 64
+ do_del "$submodule"
+ ret=$?
fi
- ret=$?
- [ $ret -ne 0 ] && break
+ [ $ret -ne 0 ] && [ $ret -ne $RET_DEL ] && break
done
check_ret $ret
}
@@ -100,12 +112,12 @@ do_wget () {
if [ "$(dirname $2)" != "." ]; then
toplevel="$(dirname $2)"
fi
- announce "$1 $toplevel (wget)" delimit
+ do_announce "$1 $toplevel (wget)" $CLR_SCR delimit
if [ "$1" == "get" ]; then
wget --no-verbose --no-clobber --execute robots=off \
--directory-prefix "$2" "${@:3}" 2>&1
else
- do_del "$toplevel" && return 64
+ do_del "$toplevel"
fi
check_ret $?
}
@@ -117,7 +129,7 @@ do_svn () {
if [ "$(dirname $2)" != "." ]; then
toplevel="$(dirname $2)"
fi
- announce "$1 $toplevel (svn)" delimit
+ do_announce "$1 $toplevel (svn)" $CLR_SCR delimit
if [ "$1" == "get" ]; then
rev=""
if [ $# -ge 4 ]; then
@@ -125,7 +137,7 @@ do_svn () {
fi
svn checkout --force $rev "$3" "$2" | grep "revision"
else
- do_del "$toplevel" && return 64
+ do_del "$toplevel"
fi
check_ret $?
}
@@ -153,8 +165,8 @@ main () {
eval "case \"$1\" in
$CHOICES)
$1 $action
- ret=$?
- [ $ret -ne 0 ] && [ $ret -ne 64 ] && return $ret
+ ret=\$?
+ [ \$ret -ne 0 -a \$ret -ne $RET_DEL ] && return \$ret
shift
continue;;
all)