geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r502457 - /geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/Parameters.groovy
Date Fri, 02 Feb 2007 03:05:25 GMT
Author: jdillon
Date: Thu Feb  1 19:05:24 2007
New Revision: 502457

URL: http://svn.apache.org/viewvc?view=rev&rev=502457
Log:
Add support to save params to a file, props or xml

Modified:
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/Parameters.groovy

Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/Parameters.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/Parameters.groovy?view=diff&rev=502457&r1=502456&r2=502457
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/Parameters.groovy
(original)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/Parameters.groovy
Thu Feb  1 19:05:24 2007
@@ -63,6 +63,28 @@
         return value
     }
     
+    def store(file, xml=false) {
+        assert file
+        
+        file = new File("$file").canonicalFile
+        
+        def tmp = new Properties()
+        tmp.putAll(props)
+        
+        def output = file.newOutputStream()
+        try {
+            if (xml) {
+                tmp.storeToXML(output, null)
+            }
+            else {
+                tmp.store(output, null)
+            }
+        }
+        finally {
+            output.close()
+        }
+    }
+    
     //
     // Allow params['foo'] and params['bar'] = 'baz' to work
     //



Mime
View raw message