| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
use strict; |
| 4 |
use warnings; |
| 5 |
|
| 6 |
use File::Find::Object; |
| 7 |
use IO::All; |
| 8 |
|
| 9 |
my $tree = File::Find::Object->new({}, 'lib/'); |
| 10 |
|
| 11 |
my $version_n = shift(@ARGV); |
| 12 |
|
| 13 |
if (!defined($version_n)) |
| 14 |
{ |
| 15 |
die "Specify version number as an argument! bump-version-number.pl '0.0.1'"; |
| 16 |
} |
| 17 |
|
| 18 |
sub process_file |
| 19 |
{ |
| 20 |
# The filename. |
| 21 |
my ($r) = @_; |
| 22 |
|
| 23 |
my @lines = io->file($r)->getlines(); |
| 24 |
foreach (@lines) |
| 25 |
{ |
| 26 |
s#(\$VERSION = "|^Version )\d+\.\d+(?:\.\d+)?("|)#$1 . $version_n . $2#e; |
| 27 |
} |
| 28 |
io->file($r)->print( |
| 29 |
@lines |
| 30 |
); |
| 31 |
} |
| 32 |
|
| 33 |
process_file('LibXML.pm'); |
| 34 |
|
| 35 |
while (my $r = $tree->next()) { |
| 36 |
if ($r =~ m{/\.(?:svn|hg|git)\z}) |
| 37 |
{ |
| 38 |
$tree->prune(); |
| 39 |
} |
| 40 |
elsif ($r =~ m{\.pm\z}) |
| 41 |
{ |
| 42 |
process_file($r); |
| 43 |
} |
| 44 |
} |
| 45 |
|