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
This commit is contained in:
Romain Pelisse 2011-09-11 19:15:26 +00:00
parent 779e304d18
commit c7933c9700

View File

@ -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