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/10 12:48:56 UTC

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

Author: brett
Date: Mon Jan 10 03:48:53 2005
New Revision: 124793

URL: http://svn.apache.org/viewcvs?view=rev&rev=124793
Log:
- implement rsync deployment method
- implement staging intermediate deployment area
- implement publish goal from staging to live

Modified:
   maven/maven-1/plugins/trunk/site/plugin.jelly
   maven/maven-1/plugins/trunk/site/plugin.properties
   maven/maven-1/plugins/trunk/site/xdocs/changes.xml
   maven/maven-1/plugins/trunk/site/xdocs/goals.xml
   maven/maven-1/plugins/trunk/site/xdocs/properties.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=124793&p1=maven/maven-1/plugins/trunk/site/plugin.jelly&r1=124792&p2=maven/maven-1/plugins/trunk/site/plugin.jelly&r2=124793
==============================================================================
--- maven/maven-1/plugins/trunk/site/plugin.jelly	(original)
+++ maven/maven-1/plugins/trunk/site/plugin.jelly	Mon Jan 10 03:48:53 2005
@@ -82,28 +82,51 @@
     <attainGoal name="site:${maven.site.deploy.method}deploy"/>
   </goal>
   
+  <goal name="site:local-deploy-init">
+    <j:set var="deployToLive" value="${maven.site.deploy.live}"/>
+    <j:set var="siteDirectory" value="${maven.site.stage.directory}" />
+    <j:if test="${empty(siteDirectory) or deployToLive}">
+      <j:set var="siteDirectory" value="${pom.siteDirectory}" /> 
+    </j:if>
+
+    <echo>
+      siteDirectory = ${siteDirectory}
+    </echo>
+  </goal>
+
+  <goal name="site:remote-deploy-init" prereqs="site:local-deploy-init">
+    <j:set var="siteUsername" value="${maven.site.stage.username}" />
+    <j:if test="${empty(siteUsername) or deployToLive}">
+      <j:set var="siteUsername" value="${maven.username}" /> 
+    </j:if>
+
+    <maven:user-check user="${siteUsername}"/>
+
+    <j:set var="siteAddress" value="${maven.site.stage.address}" />
+    <j:if test="${empty(siteAddress) or deployToLive}">
+      <j:set var="siteAddress" value="${pom.siteAddress}" /> 
+    </j:if>
+
+    <echo>
+      siteAddress = ${siteAddress}
+      siteUsername = ${siteUsername}
+    </echo>
+  </goal>
+
   <!-- ================================================================== -->
   <!-- S I T E  F T P  D E P L O Y                                        -->
   <!-- Deploys the site using FTP                                         -->
   <!-- ================================================================== -->
 
   <goal name="site:ftpdeploy"
-    prereqs="site:init"
+    prereqs="site:init,site:remote-deploy-init"
     description="Deploy the generated site docs using ftp">
 
-    <maven:user-check user="${maven.username}"/>
-
-    <echo>
-      siteAddress = ${pom.siteAddress}
-      siteDirectory = ${pom.siteDirectory}
-      siteUser = ${maven.username}
-    </echo>
-
     <!-- FTP to the server -->
-    <ftp server="${pom.siteAddress}"
-    	 userid="${maven.username}"
+    <ftp server="${siteAddress}"
+    	 userid="${siteUsername}"
     	 password="${maven.password}"
-    	 remotedir="${pom.siteDirectory}">
+    	 remotedir="${siteDirectory}">
          <fileset dir="${docsDest}" includes="**/*.*"/>
     </ftp>
 
@@ -115,19 +138,11 @@
   <!-- ================================================================== -->
 
   <goal name="site:sshdeploy" 
-    prereqs="site:init"
+    prereqs="site:init,site:remote-deploy-init"
     description="Deploy the generated site docs using ssh">
 
-    <maven:user-check user="${maven.username}"/>
-
-    <echo>
-      siteAddress = ${pom.siteAddress}
-      siteDirectory = ${pom.siteDirectory}
-      siteUser = ${maven.username}
-    </echo>
-
     <!-- This needs to taken from the project properties -->
-    <property name="maven.homepage" value="${pom.siteDirectory}"/>
+    <property name="maven.homepage" value="${siteDirectory}"/>
 
     <tar tarfile="${maven.build.dir}/${maven.final.name}-site.tar" basedir="${docsDest}"/>
     <gzip zipfile="${maven.build.dir}/${maven.final.name}-site.tar.gz" src="${maven.build.dir}/${maven.final.name}-site.tar"/>
@@ -135,15 +150,15 @@
 
     <!-- Make sure the destination directory exists before trying to copy -->
     <exec dir="." executable="${maven.ssh.executable}">
-      <arg line="${maven.ssh.args} -l ${maven.username} ${pom.siteAddress} 'mkdir -p ${maven.homepage}'"/>
+      <arg line="${maven.ssh.args} -l ${siteUsername} ${siteAddress} 'mkdir -p ${maven.homepage}'"/>
     </exec>
 
     <exec dir="${maven.build.dir}" executable="${maven.scp.executable}">
-      <arg line="${maven.scp.args} ${maven.final.name}-site.tar.gz ${maven.username}@${pom.siteAddress}:${maven.homepage}"/>
+      <arg line="${maven.scp.args} ${maven.final.name}-site.tar.gz ${siteUsername}@${siteAddress}:${maven.homepage}"/>
     </exec>
 
     <exec dir="." executable="${maven.ssh.executable}">
-      <arg line="${maven.ssh.args} -l ${maven.username} ${pom.siteAddress} 'cd ${maven.homepage};${maven.site.gunzip.executable} ${maven.final.name}-site.tar.gz;${maven.site.tar.executable} ${maven.site.tar.options} ${maven.final.name}-site.tar;chmod -R g+u * .;rm ${maven.final.name}-site.tar'"/>
+      <arg line="${maven.ssh.args} -l ${siteUsername} ${siteAddress} 'cd ${maven.homepage};${maven.site.gunzip.executable} ${maven.final.name}-site.tar.gz;${maven.site.tar.executable} ${maven.site.tar.options} ${maven.final.name}-site.tar;chmod -R g+u * .;rm ${maven.final.name}-site.tar'"/>
     </exec>
 
     <delete file="${maven.build.dir}/${maven.final.name}-site.tar.gz"/>
@@ -156,17 +171,12 @@
   <!-- ================================================================== -->
 
   <goal name="site:fsdeploy" 
-    prereqs="site:init"
+    prereqs="site:init,site:local-deploy-init"
     description="Deploy the generated site by copying to the site directory">
 
-    <echo>
-      siteAddress = ${pom.siteAddress}
-      siteDirectory = ${pom.siteDirectory}
-    </echo>
-
     <!-- copy the site to the directory specified in the project.xml file -->
 
-    <copy todir="${pom.siteDirectory}">
+    <copy todir="${siteDirectory}">
       <fileset dir="${docsDest}">
         <include name="**"/>
       </fileset>
@@ -207,5 +217,48 @@
       appxml="${maven.build.dir}/${plugin.artifactId}/application.xml">
       <fileset dir="${maven.build.dir}" includes="${maven.final.name}-site.war" />
     </ear>
+  </goal>
+
+  <goal name="site:publish" description="Synchronize the staged site to the live site" prereqs="site:remote-deploy-init">
+    <j:set var="destSiteAddress" value="${pom.siteAddress}" />
+    <j:set var="destSiteDirectory" value="${pom.siteDirectory}" />
+    <j:set var="destSiteUsername" value="${maven.username}" />
+
+    <echo>
+      source site address: ${siteAddress}
+      source site directory: ${siteDirectory}
+      source site username: ${siteUsername}
+      destination site address: ${destSiteAddress}
+      destination site directory: ${destSiteDirectory}
+      destination site username: ${destSiteUsername}
+    </echo>
+
+    <j:if test="${siteAddress == destSiteAddress and
+                  siteDirectory == destSiteDirectory and
+                  siteUsername == destSiteUsername}">
+      <fail>Source and destination is identical</fail>
+    </j:if>
+
+    <!-- TODO: support local FS copy -->
+    <exec dir="." executable="${maven.ssh.executable}">
+      <arg line="${siteUsername}@${siteAddress} 'mkdir -p ${destSiteDirectory}; ${maven.rsync.executable} -avz ${siteDirectory}/* ${destSiteUsername}@${destSiteAddress}:${destSiteDirectory}'" />
+    </exec>
+    
+    <!-- TODO: implement optional -delete -->
+  </goal>
+
+  <goal name="site:rsyncdeploy" 
+    description="Deploy the generated site using rsync"
+    prereqs="site:init,site:remote-deploy-init">
+    <exec dir="." executable="${maven.ssh.executable}">
+      <arg line="${siteUsername}@${siteAddress} 'mkdir -p ${siteDirectory}'" />
+    </exec>
+    
+    <maven:makeRelativePath var="relativeDocsDest" path="${docsDest}" separator="/" basedir="${basedir}" />
+    <exec dir="." executable="${maven.rsync.executable}">
+      <arg line="-avz ${relativeDocsDest}/* ${siteUsername}@${siteAddress}:${siteDirectory}" />
+    </exec>
+    
+    <!-- TODO: implement optional -delete -->
   </goal>
 </project>

Modified: maven/maven-1/plugins/trunk/site/plugin.properties
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/site/plugin.properties?view=diff&rev=124793&p1=maven/maven-1/plugins/trunk/site/plugin.properties&r1=124792&p2=maven/maven-1/plugins/trunk/site/plugin.properties&r2=124793
==============================================================================
--- maven/maven-1/plugins/trunk/site/plugin.properties	(original)
+++ maven/maven-1/plugins/trunk/site/plugin.properties	Mon Jan 10 03:48:53 2005
@@ -30,5 +30,7 @@
 maven.site.tar.options=xUvf
 maven.site.gunzip.executable=gunzip
 
+maven.rsync.executable=rsync
+
 maven.username=USERNAME_NOT_SET
 

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=124793&p1=maven/maven-1/plugins/trunk/site/xdocs/changes.xml&r1=124792&p2=maven/maven-1/plugins/trunk/site/xdocs/changes.xml&r2=124793
==============================================================================
--- maven/maven-1/plugins/trunk/site/xdocs/changes.xml	(original)
+++ maven/maven-1/plugins/trunk/site/xdocs/changes.xml	Mon Jan 10 03:48:53 2005
@@ -24,6 +24,9 @@
     <author email="dion@multitask.com.au">dIon Gillard</author>
   </properties>
   <body>
+    <release version="1.6-SNAPSHOT" date="in SVN">
+      <action dev="brett" type="add">Add the ability to have an intermediate staging publish step for the site</action>
+    </release>
     <release version="1.5.2" date="2004-10-23">
       <action dev="dion" type="update" issue="MPSITE-15" due-to="M. Sean Gilligan">Allow tar options as a property</action>
     </release>

Modified: maven/maven-1/plugins/trunk/site/xdocs/goals.xml
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/site/xdocs/goals.xml?view=diff&rev=124793&p1=maven/maven-1/plugins/trunk/site/xdocs/goals.xml&r1=124792&p2=maven/maven-1/plugins/trunk/site/xdocs/goals.xml&r2=124793
==============================================================================
--- maven/maven-1/plugins/trunk/site/xdocs/goals.xml	(original)
+++ maven/maven-1/plugins/trunk/site/xdocs/goals.xml	Mon Jan 10 03:48:53 2005
@@ -60,7 +60,17 @@
             Generates the site using the <code>site:generate</code>, and then
             deploys the site using either <code>ssh</code> or copying via the 
             file system, depending on the <code>maven.site.deploy.method</code>
-            property.
+            property. If the <code>maven.site.stage.address</code> or <code>maven.site.stage.directory</code>
+            properties are set then the site is deployed there instead for later publishing with
+            <code>site:publish</code>
+          </td>
+        </tr>
+        <tr>
+          <td>site:publish</td>
+          <td>
+            This will synchronize the stage directory to the live directory, using rsync.
+            If rsync is not available on either of the machines, you should use the <code>site:deploy</code>
+            goal again instead, with <code>maven.site.deploy.live</code> set to <code>true</code>.
           </td>
         </tr>
         <tr>
@@ -72,9 +82,22 @@
           </td>
         </tr>
         <tr>
+          <td>site:ftpdeploy</td>
+          <td>
+            Deploys the site by FTP'ing the docs to the <code>pom.siteDirectory</code>
+            directory on the <code>pom.siteAddress</code> server.
+          </td>
+        </tr>
+        <tr>
           <td>site:fsdeploy</td>
           <td>
             Deploys the site by coping the docs to the <code>pom.siteDirectory</code>
+          </td>
+        </tr>
+        <tr>
+          <td>site:rsyncdeploy</td>
+          <td>
+            Deploys the site by rsyncing the docs to the <code>pom.siteDirectory</code>
           </td>
         </tr>
       </table>

Modified: maven/maven-1/plugins/trunk/site/xdocs/properties.xml
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/site/xdocs/properties.xml?view=diff&rev=124793&p1=maven/maven-1/plugins/trunk/site/xdocs/properties.xml&r1=124792&p2=maven/maven-1/plugins/trunk/site/xdocs/properties.xml&r2=124793
==============================================================================
--- maven/maven-1/plugins/trunk/site/xdocs/properties.xml	(original)
+++ maven/maven-1/plugins/trunk/site/xdocs/properties.xml	Mon Jan 10 03:48:53 2005
@@ -29,6 +29,29 @@
     <section name="Site Properties">
       <table>
         <tr>
+          <td>maven.site.stage.address</td>
+          <td>Yes</td>
+          <td>
+            Specifies the site address to use when publishing to staging. If not specified, the same address
+            is used as live.
+          </td>
+        </tr>
+        <tr>
+          <td>maven.site.stage.directory</td>
+          <td>Yes</td>
+          <td>
+            Specifies the site directory to use when publishing to staging. If not specified, the same directory
+            is used as live.
+          </td>
+        </tr>
+        <tr>
+          <td>maven.site.deploy.live</td>
+          <td>Yes</td>
+          <td>
+            Force the use of the live deployment parameters, even if the staging ones are specified
+          </td>
+        </tr>
+        <tr>
           <td>maven.scp.executable</td>
           <td>Yes</td>
           <td>
@@ -57,6 +80,17 @@
           </td>
         </tr>
         <tr>
+          <td>maven.rsync.executable</td>
+          <td>Yes</td>
+          <td>
+            Specifies the name (and possibly location) of the remote rsync
+            executable to use. This is used by the "site:publish" and
+            "site:rsyncdeploy" goal.
+            The default value is <code>rsync</code> (i.e. an executable
+            named <code>rsync</code> must be in your path).
+          </td>
+        </tr>
+        <tr>
           <td>maven.ssh.args</td>
           <td>Yes</td>
           <td>
@@ -67,7 +101,7 @@
           <td>maven.site.deploy.method</td>
           <td>Yes</td>
           <td>
-            Specifies the method to use when deploying the site. Possible values are:
+            Specifies the method to use when deploying the site. Possible values are: <code>ftp</code>, <code>rsync</code>, 
             <code>fs</code> and <code>ssh</code>. The ssh method is the good old 
             method which has always been used within Maven. When you specify 
             <code>fs</code> the site will be deployed on a local file system. 

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