-
Notifications
You must be signed in to change notification settings - Fork 463
/
update_version.pl
executable file
·41 lines (35 loc) · 1.04 KB
/
update_version.pl
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
# Usage: update_version.pl <old_version_X.Y.Z> <new_version_X.Y.Z>
use strict;
my @patterns = qw!features/org.opendds.modeling.feature/feature.xml
features/org.opendds.modeling.site/site.xml
plugins/*/META-INF/MANIFEST.MF
plugins/org.opendds.modeling.gmf/diagrams/*.gmfgen
plugins/org.opendds.modeling.common/about.properties!;
if ($#ARGV < 1) {
die "Usage: update_version.pl <old_version_X.Y.Z> <new_version_X.Y.Z>\n";
}
my ($old, $new) = @ARGV;
$old = quotemeta($old);
for my $pat (@patterns) {
for my $file (glob $pat) {
open(IN, $file) or die "can't read $file";
my @lines = ();
my $match = 0;
while (<IN>) {
if (s/$old/$new/g) {
$match = 1;
}
push(@lines, $_);
}
close IN;
if ($match) {
open(OUT, '>' . $file) or die "can't write $file";
print OUT @lines;
close OUT;
print "Updated $file\n";
}
}
}