]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - tag-release
plugin(factoids): use registry for storage see #42
[user/henk/code/ruby/rbot.git] / tag-release
index 6038e5a8d60df89a9f329c14497145ee7c19dda1..a1e916ff875d7928b20c1c3038fe097b2dbfd95b 100755 (executable)
@@ -5,23 +5,36 @@ if [ -z $1 ]; then
        exit
 fi
 
+abort() {
+       echo $1
+       exit 1
+}
+
 FULLVERSION=$1
 VERSION=${FULLVERSION/-*/}
 
 echo "Full version: $FULLVERSION"
 echo "Version: $VERSION"
 
-sed -ine "/^\$version =/ c \$version = '$FULLVERSION'" launch_here.rb   
-sed -ine "/^\$version ||=/ c \$version ||= '$FULLVERSION'" bin/rbot
-sed -ine "/^  s.version =/ c \  s.version = '$VERSION'" Rakefile   
+sed -i -e "/^\$version =/ c \$version = '$FULLVERSION'" launch_here.rb
+sed -i -e "/^\$version ||=/ c \$version ||= '$FULLVERSION'" bin/rbot
+sed -i -e "/^  s.version =/ c \  s.version = '$VERSION'" rbot.gemspec
+sed -i -e "/^  <!ENTITY dhpackageversion / c \  <!ENTITY dhpackageversion \"$VERSION\">" man/*.xml
 
-git commit -m "Version $FULLVERSION" -a
-git tag -a -m "rbot $FULLVERSION" rbot-$FULLVERSION
-rake package
-if [ $VERSION != $FULLVERSION ]; then
-       pushd pkg
-       mv rbot-$VERSION.gem rbot-$FULLVERSION.gem
-       mv rbot-$VERSION.tgz rbot-$FULLVERSION.tgz
-       mv rbot-$VERSION.zip rbot-$FULLVERSION.zip
-       popd
+NOGIT=${FULLVERSION/-git/}
+if [ $NOGIT == $FULLVERSION ]; then
+       # Not a git version
+       rake package || abort "Failed to build package!"
+       git commit -m "Version $FULLVERSION" -a || abort "Failed to commit release!"
+       git tag -a -m "rbot $FULLVERSION" rbot-$FULLVERSION || abort "Failed to tag release!"
+       if [ $VERSION != $FULLVERSION ]; then
+               pushd pkg
+               mv rbot-$VERSION.gem rbot-$FULLVERSION.gem
+               mv rbot-$VERSION.tgz rbot-$FULLVERSION.tgz
+               mv rbot-$VERSION.zip rbot-$FULLVERSION.zip
+               popd
+       fi
+else
+       # git version
+       git commit -m "Start working on $NOGIT" -a
 fi