#!/usr/bin/perl -w

system("rm -f *.csv");
my @tables = <tables.??.vot>;
foreach my $t (@tables) {
    my $csv = $t;
    $csv =~ s/vot$/csv/;
    system("./parse_vot.pl $t > $csv");
}

system("./parse_schema_browser.pl schema_browser.vot");
system("./render.pl");
system("pdflatex schema.tex");


my $svn = '';
open(SI, "svn info . | ");
while (<SI>) {
    chomp;
    if ($_ =~ /Last Changed Rev:/) {
	$svn = (split /\s+/, $_)[3];
    }
}
close(SI);

$svn = 'r' . $svn;

system("mv schema.pdf schema.${svn}.pdf");
system("tar -zcf schema.${svn}.tgz schema.${svn}.pdf tables.*.csv SchemaTables.csv SchemaTableType.csv");
