[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [917] branches/1.2/upgrade.pl



Revision: 917
          http://svn.sourceforge.net/ledger-smb/?rev=917&view=rev
Author:   einhverfr
Date:     2007-03-16 16:51:02 -0700 (Fri, 16 Mar 2007)

Log Message:
-----------
upgrade.pl now works to upgrade templates

Modified Paths:
--------------
    branches/1.2/upgrade.pl

Modified: branches/1.2/upgrade.pl
===================================================================
--- branches/1.2/upgrade.pl	2007-03-16 06:00:09 UTC (rev 916)
+++ branches/1.2/upgrade.pl	2007-03-16 23:51:02 UTC (rev 917)
@@ -1,3 +1,22 @@
 #!/usr/bin/perl
 
-`perl -ibak -pe 's|<\%(\.)\%>|<?lsmb $1 ?>|g' templates/*`
+my $dirpath = $ARGV[1];
+$dirpath ||= 'templates';
+
+&process_dir($dirpath);
+
+sub process_dir {
+	my $dirpath = shift @_;
+	opendir DIR, $dirpath || die "can't open dir $dirpath for reading:$!";
+	my @entries = readdir DIR;
+	closedir DIR;
+	for $entry(@entries){
+		my $path = "$dirpath/$entry";
+		if (-d $path && $entry !~ /^\./){
+			&process_dir($path);
+		} elsif  ($entry !~ /^\./){
+			print "Processing path $path\n";
+			`perl -ibak -pe 's|\<\%(.*)\%\>|<?lsmb \$1 ?>|g' $path`
+		}
+	}
+}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.