From c7933c9700e91adf59abafc72ecfb54a511ab6b1 Mon Sep 17 00:00:00 2001 From: Romain Pelisse Date: Sun, 11 Sep 2011 19:15:26 +0000 Subject: [PATCH] make docs.sh able to use svn or git to restore files git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/4.2.x@7244 51baf565-9d33-0410-a72c-fc3788e3496d --- pmd/docs.sh | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/pmd/docs.sh b/pmd/docs.sh index e31fa9bcb4..ed7607a63b 100644 --- a/pmd/docs.sh +++ b/pmd/docs.sh @@ -1,33 +1,47 @@ #!/bin/bash +restore_from_repository() { + local dir="${1}" + + git status "${dir}" + local status="${?}" + if [ ${status} -eq 0 ]; then + git reset HEAD "${dir}" + git checkout "${dir}" + else + svn up "${dir}" + fi +} + option="${1}" if [ -z $option ]; then echo "Generating from pom, regenerating ruleset docs, and transforming" ruby munge_rulesets.rb - maven -qb pmd:rulesets-index xdoc:generate-from-pom - maven -qb pmd:ruleset-docs + maven -qb pmd:rulesets-index xdoc:generate-from-pom + maven -qb pmd:ruleset-docs rm -f rulesets/*.xml - svn up rulesets - maven -qb xdoc:transform + restore_from_repository rulesets + maven -qb xdoc:transform elif [ $option = "all" ]; then echo "Running maven site" rm -rf target ruby munge_rulesets.rb maven -qb site rm -f rulesets/*.xml - svn up rulesets + restore_from_repository rulesets + maven -qb xdoc:transform elif [ $option = "uploadcurrent" ]; then echo "Generating and uploading maven artifacts" mvn -q source:jar javadoc:jar deploy mvn -q deploy:deploy-file -Durl=scp://shell.sourceforge.net/home/groups/p/pm/pmd/htdocs/maven2 -DrepositoryId=pmd-repo -Dfile=java14/lib/pmd14-4.2.6.jar -DpomFile=pmd-jdk14-pom.xml echo "Generating xdocs and uploading" ruby munge_rulesets.rb - maven -qb pmd:rulesets-index xdoc:generate-from-pom - maven -qb pmd:ruleset-docs + maven -qb pmd:rulesets-index xdoc:generate-from-pom + maven -qb pmd:ruleset-docs rm -f rulesets/*.xml - svn up rulesets - maven -qb xdoc:transform + restore_from_repository rulesets + maven -qb xdoc:transform DOCS_FILE=docs.tar.gz cp xdocs/cpdresults.txt xdocs/cpp_cpdresults.txt target/docs/ cd target/docs