3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-18 01:49:53 +01:00
pbot/build/update-version.pl
2010-06-05 00:30:03 +00:00

31 lines
686 B
Perl
Executable File

#!perl
use warnings;
use strict;
use POSIX qw(strftime);
my $svn_info = `svn info -r head`;
my ($rev) = $svn_info =~ /Last Changed Rev: (\d+)/;
my $date = strftime "%Y-%m-%d", localtime;
$rev++;
print "New version: $rev $date\n";
open my $in, '<', "PBot/PBot.pm" or die "Couldn't open PBot.pm for reading: $!";
my @lines = <$in>;
close $in;
open my $out, '>', "PBot/PBot.pm" or die "Couldn't open PBot.pm for writing: $!";
foreach my $text (@lines) {
$text =~ s/BUILD_NAME\s+=> ".*",/BUILD_NAME => "PBot",/;
$text =~ s/BUILD_REVISION\s+=> \d+,/BUILD_REVISION => $rev,/;
$text =~ s/BUILD_DATE\s+=> ".*",/BUILD_DATE => "$date",/;
print $out $text;
}
close $out;