add clean ability
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@124902 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
1 parent
418d3ced0c
commit
512f028082
2 files changed
+35
-6
No files matched your search
+34
-6
@@ -149,6 +149,13 @@
|
||||
<gzip zipfile="${maven.build.dir}/${maven.final.name}-site.tar.gz" src="${maven.build.dir}/${maven.final.name}-site.tar"/>
|
||||
<delete file="${maven.build.dir}/${maven.final.name}-site.tar"/>
|
||||
|
||||
<j:if test="${siteClean}">
|
||||
<echo>Cleaning destination first</echo>
|
||||
<exec dir="." executable="${maven.ssh.executable}">
|
||||
<arg line="${siteUsername}@${siteAddress} 'rm -r ${siteDirectory}'" />
|
||||
</exec>
|
||||
</j:if>
|
||||
|
||||
<!-- Make sure the destination directory exists before trying to copy -->
|
||||
<exec dir="." executable="${maven.ssh.executable}">
|
||||
<arg line="${maven.ssh.args} -l ${siteUsername} ${siteAddress} 'mkdir -p ${maven.homepage}'"/>
|
||||
@@ -175,8 +182,12 @@
|
||||
prereqs="site:init,site:local-deploy-init"
|
||||
description="Deploy the generated site by copying to the site directory">
|
||||
|
||||
<!-- copy the site to the directory specified in the project.xml file -->
|
||||
<j:if test="${siteClean}">
|
||||
<echo>Cleaning destination first</echo>
|
||||
<delete dir="${siteDirectory}" />
|
||||
</j:if>
|
||||
|
||||
<mkdir dir="${siteDirectory}" />
|
||||
<copy todir="${siteDirectory}">
|
||||
<fileset dir="${docsDest}" />
|
||||
</copy>
|
||||
@@ -242,24 +253,39 @@
|
||||
<j:choose>
|
||||
<j:when test="${deployMethod == 'fs'}">
|
||||
<echo>Executing filesystem copy on local server to publish</echo>
|
||||
<j:if test="${siteClean}">
|
||||
<echo>Cleaning destination first</echo>
|
||||
<delete dir="${destSiteDirectory}" />
|
||||
</j:if>
|
||||
<mkdir dir="${destSiteDirectory}" />
|
||||
<copy todir="${destSiteDirectory}">
|
||||
<fileset dir="${siteDirectory}" />
|
||||
</copy>
|
||||
</j:when>
|
||||
<j:when test="${siteAddress == destSiteAddress}">
|
||||
<echo>Executing filesystem copy on remote server to publish</echo>
|
||||
<j:if test="${siteClean}">
|
||||
<echo>Cleaning destination first</echo>
|
||||
<exec dir="." executable="${maven.ssh.executable}">
|
||||
<arg line="${siteUsername}@${siteAddress} 'rm -r ${destSiteDirectory}'" />
|
||||
</exec>
|
||||
</j:if>
|
||||
<exec dir="." executable="${maven.ssh.executable}">
|
||||
<arg line="${siteUsername}@${siteAddress} 'mkdir -p ${destSiteDirectory}; cp -r ${siteDirectory}/* ${destSiteDirectory}'" />
|
||||
</exec>
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<echo>Executing rsync on stage server to publish to live server</echo>
|
||||
<j:set var="rsyncArgs" value="${maven.rsync.args}" />
|
||||
<j:if test="${siteClean}">
|
||||
<echo>Cleaning destination</echo>
|
||||
<j:set var="rsyncArgs" value="${rsyncArgs} --delete" />
|
||||
</j:if>
|
||||
<exec dir="." executable="${maven.ssh.executable}">
|
||||
<arg line="${siteUsername}@${siteAddress} '${maven.rsync.executable} -avz ${siteDirectory}/* ${destSiteUsername}@${destSiteAddress}:${destSiteDirectory}'" />
|
||||
<arg line="${siteUsername}@${siteAddress} '${maven.rsync.executable} ${rsyncArgs} -avz ${siteDirectory}/* ${destSiteUsername}@${destSiteAddress}:${destSiteDirectory}'" />
|
||||
</exec>
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
<!-- TODO: implement optional -delete -->
|
||||
</goal>
|
||||
|
||||
<goal name="site:rsyncdeploy"
|
||||
@@ -270,11 +296,13 @@
|
||||
</exec>
|
||||
|
||||
<maven:makeRelativePath var="relativeDocsDest" path="${docsDest}" separator="/" basedir="${basedir}" />
|
||||
<j:if test="${siteClean}">
|
||||
<echo>Cleaning destination</echo>
|
||||
<j:set var="rsyncArgs" value="${rsyncArgs} --delete" />
|
||||
</j:if>
|
||||
<exec dir="." executable="${maven.rsync.executable}">
|
||||
<arg line="-avz ${relativeDocsDest}/* ${siteUsername}@${siteAddress}:${siteDirectory}" />
|
||||
<arg line="-avz ${rsyncArgs} ${relativeDocsDest}/* ${siteUsername}@${siteAddress}:${siteDirectory}" />
|
||||
</exec>
|
||||
|
||||
<!-- TODO: implement optional -delete -->
|
||||
</goal>
|
||||
</project>
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
</properties>
|
||||
<body>
|
||||
<release version="1.6-SNAPSHOT" date="in SVN">
|
||||
<action dev="brett" type="add">Add ability to clean the destination before deployment</action>
|
||||
<action dev="brett" type="add" issue="MPSITE-21">Add the rsync deployment method</action>
|
||||
<action dev="brett" type="add">Add the ability to have an intermediate staging publish step for the site</action>
|
||||
</release>
|
||||
|
||||
Reference in new issue
Block a user