File: bump-version-number.pl

package info (click to toggle)
libxml-libxml-perl 2.0207%2Bdfsg%2Breally%2B2.0134-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,572 kB
  • sloc: perl: 6,310; ansic: 3,851; xml: 182; sh: 21; makefile: 16
file content (45 lines) | stat: -rw-r--r-- 742 bytes parent folder | download | duplicates (9)
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
42
43
44
45
#!/usr/bin/perl

use strict;
use warnings;

use File::Find::Object;
use IO::All;

my $tree = File::Find::Object->new({}, 'lib/');

my $version_n = shift(@ARGV);

if (!defined($version_n))
{
    die "Specify version number as an argument! bump-version-number.pl '0.0.1'";
}

sub process_file
{
    # The filename.
    my ($r) = @_;

    my @lines = io->file($r)->getlines();
    foreach (@lines)
    {
        s#(\$VERSION = "|^Version )\d+\.\d+(?:\.\d+)?("|)#$1 . $version_n . $2#e;
    }
    io->file($r)->print(
        @lines
    );
}

process_file('LibXML.pm');

while (my $r = $tree->next()) {
    if ($r =~ m{/\.(?:svn|hg|git)\z})
    {
        $tree->prune();
    }
    elsif ($r =~ m{\.pm\z})
    {
        process_file($r);
    }
}