Author: ssmiweve
Date: 2008-01-17 18:49:20 +0100 (Thu, 17 Jan 2008)
New Revision: 5980

Modified:
   trunk/mojo/src/main/java/no/sesat/mojo/DeploySesatWarfilesMojo.java
Log:
use -Dsesat.mojo.dryRun=true for dry runs

Modified: trunk/mojo/src/main/java/no/sesat/mojo/DeploySesatWarfilesMojo.java
===================================================================
--- trunk/mojo/src/main/java/no/sesat/mojo/DeploySesatWarfilesMojo.java 
2008-01-17 10:21:33 UTC (rev 5979)
+++ trunk/mojo/src/main/java/no/sesat/mojo/DeploySesatWarfilesMojo.java 
2008-01-17 17:49:20 UTC (rev 5980)
@@ -24,6 +24,8 @@
 import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Calendar;
@@ -80,6 +82,10 @@
     // Constants -----------------------------------------------------
 
     private static final String[] ENVIRONMENTS = new 
String[]{"alpha","nuclei","beta","electron","gamma","production"};
+    
+    private static final String TAG_ON_DEPLOY = "tag.on.deploy";
+    
+    private static final String DRY_RUN = "sesat.mojo.dryRun";
 
     // Attributes ----------------------------------------------------
 
@@ -334,18 +340,36 @@
                             ? sesamSite
                             : project.getBuild().getFinalName();
 
-                    // we are ready to go. but first tag the code
-                    
if(Boolean.parseBoolean(project.getProperties().getProperty("tag.on.deploy"))){
+                    // tag the code
+                    
if(Boolean.parseBoolean(project.getProperties().getProperty(TAG_ON_DEPLOY))
+                            && !Boolean.getBoolean(DRY_RUN)){
+                        
                         tagDeploy();
                     }
 
-                    // now do the upload
+                    // do the upload
                     getLog().info("Uploading " + 
artifact.getFile().getAbsolutePath()
                             + " to " + wagon.getRepository().getUrl() + '/' + 
destName + ".war");
-                    wagon.put(artifact.getFile(), destName + ".war");
+                    
+                    if(!Boolean.getBoolean(DRY_RUN)){
+                        wagon.put(artifact.getFile(), destName + ".war");
+                    }
+                    
+                    // update the version.txt
+                    getLog().info("Updating " + wagon.getRepository().getUrl() 
+ "/version.txt");
+                        
+                    if(Boolean.getBoolean(DRY_RUN)){
+                        
+                        final StringWriter sb = new StringWriter();
+                        final BufferedWriter w = new BufferedWriter(sb);
+                        updateArtifactEntry(new BufferedReader(new 
StringReader("")), w);
+                        w.flush();
+                        getLog().info("version.txt entry will be \n" + 
sb.toString());
+                        
+                    }else{
 
-                    getLog().info("Updating " + wagon.getRepository().getUrl() 
+ "/version.txt");
-                    updateVersionFile(wagon);
+                        updateVersionFile(wagon);
+                    }
                 }
             }
 

_______________________________________________
Kernel-commits mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-commits

Reply via email to