Commits

Shlomi Fish committed 6b72db7

Add bump-ver-num.

  • Participants
  • Parent commits 8b311c1

Comments (0)

Files changed (3)

modules/App-XML-DocBook-Docmake/Changes

 0.0402  Tue 21 May 17:48:25 IDT 2013
         - Remove trailing space - t/style-trailing-space.t .
         - Update the repository in Build.PL .
+        - Add script/bump-version-number.pl .
 
 0.0401  Wed  5 Sep 19:45:47 IDT 2012
         - Move away tag-release.pl under script.

modules/App-XML-DocBook-Docmake/MANIFEST

 MANIFEST
 META.yml # Will be created by "make dist"
 README
+script/bump-version-number.pl
 script/docmake
 script/tag-release.pl
 t/00-load.t

modules/App-XML-DocBook-Docmake/script/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'";
+}
+
+while (my $r = $tree->next()) {
+    if ($r =~ m{/\.svn\z})
+    {
+        $tree->prune();
+    }
+    elsif ($r =~ m{\.pm\z})
+    {
+        my @lines = io->file($r)->getlines();
+        foreach (@lines)
+        {
+            s#(\$VERSION = '|^Version )\d+\.\d+(?:\.\d+)?('|)#$1 . $version_n . $2#e;
+        }
+        io->file($r)->print(
+            @lines
+        );
+    }
+}
+