Commits

Shlomi Fish  committed c8aac8a

Add bump-version-number.

  • Participants
  • Parent commits a0947a1

Comments (0)

Files changed (3)

File module/ChangeLog

   - Add a $VERSION variable for Error::Simple.
     - thanks to Kevin Dawson for the report.
+  - Add scripts/bump-version-number.pl .
+    - This can be used to bump the version numbers globally.
 
 Feb 11 2012 <shlomif@shlomifish.org> (Shlomi Fish)
 

File module/MANIFEST

 MANIFEST
 META.yml                                 Module meta-data (added by MakeMaker)
 README
+scripts/bump-version-number.pl
 t/01throw.t
 t/02order.t
 t/03throw-non-Error.t

File module/scripts/bump-version-number.pl

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