Last active
November 11, 2015 00:19
-
-
Save danhaywood/3129b688be3628322c01 to your computer and use it in GitHub Desktop.
all.sh - script to update addons in bulk.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#ls -d1 isis-* template > _all.txt | |
usage() | |
{ | |
cat << EOF | |
usage: $0 options command | |
Runs the specified command for all uncommented files in _all.txt | |
(or as specified by -f flag) | |
OPTIONS: | |
-f [file] file to read from (defaults to _all.txt) | |
-m [message] commit: message for git commit | |
-r [rel ver] release: release version | |
-s [snap ver] release: snapshot version | |
-t [tag] tag name | |
-k [key] key id (usually an email address) | |
-p [pwd] password to access keystore holding private signing key | |
command run command, where command is: | |
gs = git status | |
status = git status | |
diff = git diff | |
fetch = git fetch | |
mci = mvn clean install -T1C | |
mcio = mvn clean install -T1C -o | |
mciost = mvn clean install -T1C -o -DskipTests=true | |
merge = git merge --no-ff ... | |
add = git add . | |
commit = git commit -am ... (see also -m flag) | |
bumpisis = bumpver_isis.sh | |
release = sh release.sh -r ... -s ... -k ... -p ... | |
push = git push origin master | |
gpom = git push origin master | |
gpot = git push origin ... | |
EXAMPLES: | |
sh $0 gs | |
sh $0 status | |
sh $0 diff | |
sh $0 fetch | |
sh $0 mci | |
sh $0 mcio | |
sh $0 mciost | |
sh $0 -b "origin/master" merge | |
sh $0 add | |
sh $0 -m "ISIS-1234: yada yada" commit | |
sh $0 -r "1.9.0" bumpisis | |
sh $0 -r "1.9.0" -s "1.10.0-SNAPSHOT" -k dan@haywood-associates.co.uk -p "this is not my password" release | |
sh $0 push | |
sh $0 gpom | |
sh $0 -t "1.9.0" gpot | |
EOF | |
} | |
file="_all.txt" | |
while getopts "f:m:r:s:b:t:k:p:" OPT; do | |
case "$OPT" in | |
f) file=$OPTARG | |
;; | |
m) message=$OPTARG | |
;; | |
r) release=$OPTARG | |
;; | |
t) tag=$OPTARG | |
;; | |
s) snapshot=$OPTARG | |
;; | |
b) branch=$OPTARG | |
;; | |
k) keyid=$OPTARG | |
;; | |
p) password=$OPTARG | |
;; | |
*) | |
usage | |
exit 1;; | |
esac | |
done | |
shift $((OPTIND-1)) | |
exec="$*" | |
if [ "$exec" == "commit" ] && [ "$message" == "" ]; then | |
usage | |
exit 1 | |
fi | |
if [ "$exec" == "release" ]; then | |
if [ "$release" == "" ] -or [ "$snapshot" == "" ] ; then | |
usage | |
exit 1 | |
fi | |
if [ "$keyid" == ""] -or [ "$password" == "" ] ; then | |
usage | |
exit 1 | |
fi | |
fi | |
echo | |
echo "exec = $exec" | |
echo "message = $message" | |
echo "release = $release" | |
echo "snapshot = $snapshot" | |
echo "keyid = $keyid" | |
#echo "password = $password" | |
echo "file = $file" | |
echo | |
for a in `cat $file | \ | |
grep -v ^# | \ | |
grep -v jrebel | \ | |
grep -v xdocreport | \ | |
grep -v wizard `; do | |
echo | |
echo | |
echo $a | |
echo | |
pushd $a >/dev/null | |
case "$exec" in | |
gs) | |
git status --porcelain | |
;; | |
status) | |
git status --porcelain | |
;; | |
fetch) | |
git fetch | |
;; | |
diff) | |
git diff | |
;; | |
mci) | |
mvn clean install -T1C | |
if [ $? != 0 ]; then | |
echo "************** FAILED **************" >&2 | |
popd >/dev/null | |
exit 1 | |
fi | |
;; | |
mcio) | |
mvn clean install -T1C -o | |
if [ $? != 0 ]; then | |
echo "************** FAILED **************" >&2 | |
popd >/dev/null | |
exit 1 | |
fi | |
;; | |
mciost) | |
mvn clean install -T1C -o -DskipTests=true | |
if [ $? != 0 ]; then | |
echo "************** FAILED **************" >&2 | |
popd >/dev/null | |
exit 1 | |
fi | |
;; | |
merge) | |
git merge --no-ff "$branch" | |
;; | |
add) | |
git add . | |
;; | |
commit) | |
gitstatus=`git status --porcelain` | |
if [ n"$gitstatus" == "n" ]; then | |
echo "... nothing to commit" | |
else | |
git commit -m "$message" | |
fi | |
;; | |
push) | |
git push origin master | |
;; | |
gpom) | |
git push origin master | |
;; | |
gpot) | |
git push origin $tag | |
;; | |
release) | |
sh release.sh $release $snapshot $keyid "$password" | |
if [ $? != 0 ]; then | |
echo "************** FAILED **************" >&2 | |
popd >/dev/null | |
exit 1 | |
fi | |
;; | |
bumpisis) | |
sh bumpver_isis.sh $release | |
;; | |
*) | |
usage | |
exit 1 | |
;; | |
esac | |
popd >/dev/null | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment