forked from jmcameron/attachments
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfixvd
executable file
·25 lines (19 loc) · 808 Bytes
/
fixvd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/perl -i
# Get the release version number
$v = $ENV{ATVERS};
die "Must specify version number by setting version with environment ATVERS" unless $v;
# Get the release date
use POSIX qw(strftime);
$d = $ENV{ATDATE};
if ($d eq '') {
$d = strftime("%B %e, %Y", (localtime));
}
print "fixvd $ARGV[0] with version :$v date:$d\n";
while (<>) {
s|^([ \t]+<version>)[^<]+</version>|\1$v</version>|;
s|^([ \t]+<creationDate>)[^<]+</creationDate>|\1$d</creationDate>|;
s|^([ \t]+public static[ \t]+\$ATTACHMENTS_VERSION[ \t]+=[ \t]+)'[^\']+'|\1'$v'|;
s|^([ \t]+public static[ \t]+\$ATTACHMENTS_VERSION_DATE[ \t]+=[ \t]+)'[^\']+'|\1'$d'|;
s|^\*\*Version .+ - [^\*]+[0-9]+\*\*$|**Version $v - $d**|;
s|v\d\.\d\.\d/attachments-\d\.\d\.\d\.|v$v\/attachments\-$v\.|;
print;}