bkerby

gvim failed

Apr 24th, 2012
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.94 KB | None | 0 0
  1. #!/bin/bash
  2. set -e -o pipefail
  3.  
  4. pomfile=pom.xml
  5.  
  6. # fail if there is no ${pomfile}
  7. if [[ ! -e ${pomfile} ]]; then
  8.   echo "Error: cannot edit ${pomfile}: No such file"
  9.   exit 1
  10. fi
  11.  
  12. # fail if "git checkout develop" didn't succeed
  13. echo "Calling git checkout develop"
  14. git checkout develop
  15. if [[ $? -ne 0 ]]; then
  16.   exit 1
  17. fi
  18.  
  19. VERSION=`grep -o -P "(?<=\<version\>).*(?=\</version\>)" ${pomfile} \
  20.        | grep -o -P "[0-9][0-9\.]+[0-9]" | head -n 1`
  21. MINOR=`echo $VERSION | grep -o -P "[0-9]+$"`
  22. MAJOR=`echo $VERSION | grep -o -P "([0-9]+\.)*[0-9]+(?=\.$MINOR)"`
  23. NVERSION=$MAJOR.$(( MINOR+1 ))
  24. echo "Current version ${VERSION} bumped to new version ${NVERSION}"
  25.  
  26. git flow release start $VERSION
  27. git flow release finish -m $VERSION $VERSION
  28.  
  29. git checkout develop
  30.  
  31. # change only the first occasion of pattern
  32. sed "0,/<version>${VERSION}/s//<version>${NVERSION}/" --in-place ${pomfile}
  33.  
  34. git add pom.xml
  35. git commit -m "version bump"
Advertisement
Add Comment
Please, Sign In to add comment