You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2005/01/11 09:42:36 UTC

svn commit: r124902 - /maven/maven-1/plugins/trunk/site/plugin.jelly /maven/maven-1/plugins/trunk/site/xdocs/changes.xml

Author: brett
Date: Tue Jan 11 00:42:34 2005
New Revision: 124902

URL: http://svn.apache.org/viewcvs?view=rev&rev=124902
Log:
add clean ability
Modified:
   maven/maven-1/plugins/trunk/site/plugin.jelly
   maven/maven-1/plugins/trunk/site/xdocs/changes.xml

Modified: maven/maven-1/plugins/trunk/site/plugin.jelly
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/site/plugin.jelly?view=diff&rev=124902&p1=maven/maven-1/plugins/trunk/site/plugin.jelly&r1=124901&p2=maven/maven-1/plugins/trunk/site/plugin.jelly&r2=124902
==============================================================================
--- maven/maven-1/plugins/trunk/site/plugin.jelly	(original)
+++ maven/maven-1/plugins/trunk/site/plugin.jelly	Tue Jan 11 00:42:34 2005
@@ -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>
 

Modified: maven/maven-1/plugins/trunk/site/xdocs/changes.xml
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/site/xdocs/changes.xml?view=diff&rev=124902&p1=maven/maven-1/plugins/trunk/site/xdocs/changes.xml&r1=124901&p2=maven/maven-1/plugins/trunk/site/xdocs/changes.xml&r2=124902
==============================================================================
--- maven/maven-1/plugins/trunk/site/xdocs/changes.xml	(original)
+++ maven/maven-1/plugins/trunk/site/xdocs/changes.xml	Tue Jan 11 00:42:34 2005
@@ -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>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org