[logback-dev] svn commit: r946 - logback/trunk

noreply.ceki at qos.ch noreply.ceki at qos.ch
Fri Nov 17 16:05:12 CET 2006


Author: ceki
Date: Fri Nov 17 16:05:11 2006
New Revision: 946

Added:
   logback/trunk/version.pl

Log:

A small script to change version numbers.



Added: logback/trunk/version.pl
==============================================================================
--- (empty file)
+++ logback/trunk/version.pl	Fri Nov 17 16:05:11 2006
@@ -0,0 +1,43 @@
+
+if ($#ARGV < 1) {
+  print "Usage: version.pl VER FILE {FILE, FILE}\n";
+  exit;
+}
+
+$V= $ARGV[0];
+print "VER:$V\r\n";
+shift(@ARGV);
+
+sub replace () {
+  my $filename = $_[0];
+
+  if(-s $filename) {
+    print "Processing [" . $filename . "]\r\n";
+
+    my $backup = "$filename.original";
+    
+    rename($filename, $backup);
+    open(OUT, ">$filename");
+    open(IN, "$backup");
+    
+    my $hitCount=0;
+    while(<IN>) {
+      if($hitCount == 0 && /<version>.*<\/version>/) {
+        s/<version>.*<\/version>/<version>$V<\/version>/;
+        $hitCount++;
+      } 
+      print OUT;
+    }
+    close(IN);
+    close(OUT);
+  } else {
+    print "File [" . $filename . "] does not exist\r\n" 
+  }
+}
+
+foreach $ARG (@ARGV) {
+  do replace($ARG);
+}
+
+
+



More information about the logback-dev mailing list