geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r503928 - /geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/util/Template.groovy
Date Tue, 06 Feb 2007 00:15:11 GMT
Author: jdillon
Date: Mon Feb  5 16:15:10 2007
New Revision: 503928

URL: http://svn.apache.org/viewvc?view=rev&rev=503928
Log:
Added helpers to render files

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

Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/util/Template.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/util/Template.groovy?view=diff&rev=503928&r1=503927&r2=503928
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/util/Template.groovy
(original)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/util/Template.groovy
Mon Feb  5 16:15:10 2007
@@ -51,10 +51,10 @@
         this.template = template
     }
     
-    void render(writer) {
+    void render(Writer writer) {
         assert writer
         
-        log.info "Rendering template: $name"
+        log.debug "Rendering template: $name"
         
         def context = new VelocityContext()
         
@@ -67,6 +67,26 @@
         
         template.merge(context, writer)
         
-        log.info "Rendered template in $watch"
+        log.debug "Rendered template in $watch"
+    }
+    
+    void render(File file) {
+        assert file
+        assert file.parentFile.exists()
+        
+        if (file.exists()) {
+            log.warn "Re-rendering to: $file"
+        }
+        else {
+            log.debug "Rendering to: $file"
+        }
+        
+        def writer = file.newWriter()
+        try {
+            render(writer)
+        }
+        finally {
+            writer.close()
+        }
     }
 }



Mime
View raw message