3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-06 20:19:33 +01:00
pbot/build/update-version.pl

33 lines
786 B
Perl
Raw Normal View History

#!/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;