# Be sure to be on 'develop' branch
git checkout develop

# Pull and push all commits
git pull
git push

# Start a new release or hotfix
git-flow release start gitools-2.2.1
git-flow hotfix start gitools-2.2.1

# Update pom.xml version
# The following command only prints to display
# Check that you are going to update only the correct versions:
find . -name pom.xml | awk '{ system("sed 0,/2.1.0/s//2.2.1/ "$0)}' | grep -A2 -B3 2.2.1

# The following command will apply the changes
# Update all like this:
find . -name pom.xml | awk '{ system("sed -i 0,/2.1.0/s//2.2.1/ "$0)}'

# Go to Documentation folder.
# Check in src/conf.py if the version numbers are up to date
# Generate the documentation (which hopefully is up to date).
# verify the documentation has the same version as Gitools
cd doc
## set correct version in conf.py
gedit source/conf.py
## generate html doc 
make html
firefox html/index.html

# Go back and Compile and package
cd ..
mvn -P test-analysis clean install assembly:assembly

# Test new release
cd target
unzip gitools-2.2.1-bin.zip
gitools-2.2.1/bin/gitools
cd ..

# Deploy ZIP file
scp target/gitools-2.2.1-bin.zip bgadmin@ankara:/usr/local/gitools/www/downloads/

# Deploy Webstart
# change back to the gitools root folder
./webstart-deploy.sh 2.2.1

# Update this file on the server:
/usr/local/gitools/www/downloads/latest.txt

# Deploy documentation and clean the directory
cd doc
scp -r html/* bgadmin@ankara:/usr/local/gitools/www/documentation/
make clean
cd ..

# Commit the changes
git commit -a -m "Release version 2.2.1"

# Finish the release or hotfix
git flow release finish gitools-2.2.1
git flow hotfix finish gitools-2.2.1

# Check that you are on develop branch
git checkout develop 

# Update pom.xml versions to new SNAPSHOT version

# Check that you are going to update only the correct versions:
find . -name pom.xml | awk '{ system("sed 0,/2.2.1/s//2.3.0-SNAPSHOT/ "$0)}' | grep -A2 -B3 2.3.0-SNAPSHOT

# Update all like this:
find . -name pom.xml | awk '{ system("sed -i 0,/2.2.1/s//2.3.0-SNAPSHOT/ "$0)}'

# Commit
git commit -a -m "Next iteration version 2.3.0-SNAPSHOT"

# Push develop
git push 
git push origin






