3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-23 12:29:27 +01:00
pbot/build/update-version.pl
2014-12-29 23:04:35 -08:00

33 lines
786 B
Perl
Executable File

#!/usr/bin/perl
use warnings;
use strict;
use POSIX qw(strftime);
# my $svn_info = `svn info -r head` or die "Couldn't get revision: $!";
# my ($rev) = $svn_info =~ /Last Changed Rev: (\d+)/;
my $rev = `git rev-list --count HEAD`;
my $date = strftime "%Y-%m-%d", localtime;
$rev++;
print "New version: $rev $date\n";
open my $in, '<', "PBot/VERSION.pm" or die "Couldn't open VERSION.pm for reading: $!";
my @lines = <$in>;
close $in;
open my $out, '>', "PBot/VERSION.pm" or die "Couldn't open VERSION.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;