[slf4j-dev] svn commit: r1165 - slf4j/trunk
ceki at slf4j.org
ceki at slf4j.org
Thu Oct 2 20:14:26 CEST 2008
Author: ceki
Date: Thu Oct 2 20:14:25 2008
New Revision: 1165
Added:
slf4j/trunk/binderVersion.pl
Modified:
slf4j/trunk/goVersion.sh
slf4j/trunk/version.pl
Log:
- a perl script to edit the version number of StaticLoggerBinder.java files
This is used for version checking done by LoggerFactory
Added: slf4j/trunk/binderVersion.pl
==============================================================================
--- (empty file)
+++ slf4j/trunk/binderVersion.pl Thu Oct 2 20:14:25 2008
@@ -0,0 +1,39 @@
+
+if ($#ARGV < 1) {
+ print "Usage: binderVersion.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 $original = "$filename.original";
+
+ rename($filename, $original);
+ open(OUT, ">$filename");
+ open(IN, "$original");
+
+ while(<IN>) {
+ if(/VERSION\s+=\s+".*";/) {
+ s/VERSION\s+=\s+".*";/VERSION = "${V}";/;
+ }
+ print OUT;
+ }
+ close(IN);
+ close(OUT);
+ unlink($original);
+ } else {
+ print "File [" . $filename . "] does not exist\r\n"
+ }
+}
+
+foreach $ARG (@ARGV) {
+ do replace($ARG);
+}
Modified: slf4j/trunk/goVersion.sh
==============================================================================
--- slf4j/trunk/goVersion.sh (original)
+++ slf4j/trunk/goVersion.sh Thu Oct 2 20:14:25 2008
@@ -1,6 +1,8 @@
-VER=$1
-echo "Will use version $VER"
-echo "Changing pom.xml files"
-find . -name "pom.xml" |grep -v archetype-resources|xargs perl version.pl $VER
-echo "Changing Java files"
-find . -name "StaticLoggerBinder.java" |grep -v archetype-resources|xargs perl binderVersion.pl $VER
+
+
+VER=$1
+echo "Will use version '${VER}'"
+echo "Changing pom.xml files"
+find . -name "pom.xml" |grep -v archetype-resources|xargs perl version.pl ${VER}
+echo "Changing Java files"
+find . -name "StaticLoggerBinder.java" |grep -v archetype-resources|xargs perl binderVersion.pl ${VER}
Modified: slf4j/trunk/version.pl
==============================================================================
--- slf4j/trunk/version.pl (original)
+++ slf4j/trunk/version.pl Thu Oct 2 20:14:25 2008
@@ -4,8 +4,8 @@
exit;
}
-$V= $ARGV[0];
-print "VER:$V\r\n";
+$V=$ARGV[0];
+print "VER:'${V}'\r\n";
shift(@ARGV);
sub replace () {
@@ -23,7 +23,7 @@
my $hitCount=0;
while(<IN>) {
if($hitCount == 0 && /<version>.*<\/version>/) {
- s/<version>.*<\/version>/<version>$V<\/version>/;
+ s/<version>.*<\/version>/<version>${V}<\/version>/;
$hitCount++;
}
print OUT;
More information about the slf4j-dev
mailing list