[Swift-commit] r6649 - trunk/bin
davidk at ci.uchicago.edu
davidk at ci.uchicago.edu
Mon Jul 15 14:49:02 CDT 2013
Author: davidk
Date: 2013-07-15 14:49:02 -0500 (Mon, 15 Jul 2013)
New Revision: 6649
Modified:
trunk/bin/nswift
trunk/bin/swiftrun
Log:
Handle brackets for grouping in swift.properties
Modified: trunk/bin/nswift
===================================================================
--- trunk/bin/nswift 2013-07-14 22:02:38 UTC (rev 6648)
+++ trunk/bin/nswift 2013-07-15 19:49:02 UTC (rev 6649)
@@ -165,8 +165,8 @@
$BASH -c "echo $KEY $USERID $SCRIPTID $SCRIPTLENGTH $return_code 1 > /dev/udp/$LISTENER/$PORT" > /dev/null 2>&1 &
fi
-mv *.d/ $( ls -1rtd run*/ |tail -1 )
-rm *.swiftx *.kml
+mv *.d/ $( ls -1rtd run*/ |tail -1 ) > /dev/null 2>&1
+rm *.swiftx *.kml > /dev/null 2>&1
exit $return_code
# Local Variables:
Modified: trunk/bin/swiftrun
===================================================================
--- trunk/bin/swiftrun 2013-07-14 22:02:38 UTC (rev 6648)
+++ trunk/bin/swiftrun 2013-07-15 19:49:02 UTC (rev 6649)
@@ -162,12 +162,31 @@
# Set property values
foreach my $property_file(@property_files) {
open(PROPERTIES, $property_file) || die "Unable to open $property_file";
+
while( <PROPERTIES> ) {
chomp;
next if /^\s*#/ || /^(\s)*$/; # Ignore blank lines and comments
- my ($key, $value) = split('=', $_, 2);
- $value =~ s/\$(\w+)/$ENV{$1}/g; # Substitute environment variables
- $properties{ $key } = $value;
+ $_ =~ s/^\s+//; # Remove leading whitespace
+
+ # Handle brackets
+ if( /^site\./ && /{/ ) {
+ my $prefix = (split /\s+{/)[0];
+ while( <PROPERTIES> ) {
+ chomp;
+ next if /^\s*#/ || /^(\s)*$/;
+ $_ =~ s/^\s+//;
+ if( /^}/ ) { last; }
+ my ($key, $value) = split('=', ($prefix . ".$_"), 2);
+ $value =~ s/\$(\w+)/$ENV{$1}/g;
+ $properties{ $key } = $value;
+ }
+ }
+
+ else {
+ my ($key, $value) = split('=', $_, 2);
+ $value =~ s/\$(\w+)/$ENV{$1}/g; # Substitute environment variables
+ $properties{ $key } = $value;
+ }
}
}
More information about the Swift-commit
mailing list