Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 180 lines (144 sloc) 3.63 KB
#!/usr/bin/env bash
#==========================
# bash - find path to script
#==========================
script_abspath=$(cd "${0%/*}" && echo "$PWD/${0##*/}")
# to get the path only - not the script name - add
script_path_only=`dirname "$script_abspath"`
cd "$script_path_only"
function svn_update {
(
if [[ -d "$1/.svn" ]]; then
cat <<-MSG
=====================================================
== Update $1 from googlecode svn
=====================================================
MSG
cd "$1"
svn \
--non-interactive \
up
else
cat <<-MSG
=====================================================
== CheckOut $1 from googlecode svn
=====================================================
MSG
if [[ -d "$1" ]]; then
rm -rf "$1" || exit 1
fi
svn \
--non-interactive \
co http://$1.googlecode.com/svn/trunk $1 &&
cd "$1"
fi
) || (
cat <<-MSG
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! Failed update of $1 from googlecode svn
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
MSG
exit 1
)
}
function git_update {
(
project=$1 ; shift
user=$1 ; shift
if [[ -d "$project/.git" ]]; then
cat <<-MSG
=====================================================
== Update $project from github
=====================================================
MSG
cd "$project"
git pull
else
cat <<-MSG
=====================================================
== CheckOut $user/$project from github
=====================================================
MSG
if [[ -d "$project" ]]; then
rm -rf "$project" || exit 1
fi
git clone git://github.com/$user/$project.git &&
cd "$project"
fi
) || (
cat <<-MSG
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! Failed update of $project from github
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
MSG
exit 1
)
}
function build-ant {
(
name=$1 ; shift
cat <<-MSG
=====================================================
== Build (ant) $name ${1:+ with option : $*}
=====================================================
MSG
cd "$name"
(ant "$@" clean jar) ||
( cat <<-MSG
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! Failed build (ant) of $name ${1:+ with option : $*}
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
MSG
exit 1
)
)
}
function build-mvn {
(
name=$1 ; shift
cat <<-MSG
=====================================================
== Build (mvn) $name ${1:+ with option : $*}
=====================================================
MSG
cd "$name"
(mvn "$@" package) ||
( cat <<-MSG
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! Failed build (mvn) of $name ${1:+ with option : $*}
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
MSG
exit 1
)
)
}
function remove_sourceforge {
(
if [[ -d "clojure/.svn" ]]; then
cd clojure
if (svn info | grep sourceforge ); then
cd ..
rm -rf clojure clojure-contrib svn_sourceforge_net
cat <<-MSG
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! Remove sourceforge repository
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
MSG
fi
fi
)
}
(
remove_sourceforge &&
git_update clojure clojure &&
git_update clojure-contrib sumbach &&
build-ant clojure &&
mv -f clojure/clojure-*.jar clojure.jar &&
build-mvn clojure-contrib "-Dclojure.jar=$script_path_only/clojure.jar" "-Dmaven.test.skip=true" &&
mv -f clojure-contrib/modules/complete/target/complete-*.jar clojure-contrib.jar &&
cat <<-MSG
=====================================================
== Successfully updated Clojure and Clojure-contrib
=====================================================
MSG
)