Commits

Shlomi Fish committed ef72091

Add $VERSION to all packages and the script to update it.

Comments (0)

Files changed (6)

 META.yml            Module meta-data (added by MakeMaker)
 README
 rejects/File/Find/Object.pm
+scripts/bump-version-number.pl
 scripts/tag-release.pl
 t/01ffo.t
 t/02tree-create.t

lib/File/Find/Object.pm

 use strict;
 use warnings;
 
+our $VERSION = '0.2.10';
+
 use 5.008;
 
 use integer;
 
 package File::Find::Object::TopPath;
 
+our $VERSION = '0.2.10';
+
 use parent 'File::Find::Object::PathComp';
 
 sub new {

lib/File/Find/Object/Base.pm

 use strict;
 use warnings;
 
+our $VERSION = '0.2.10';
+
 use integer;
 
 # TODO :

lib/File/Find/Object/PathComp.pm

 use strict;
 use warnings;
 
+our $VERSION = '0.2.10';
+
 use integer;
 
 use parent 'File::Find::Object::Base';

lib/File/Find/Object/Result.pm

 use strict;
 use warnings;
 
+our $VERSION = '0.2.10';
+
 use integer;
 
 use Class::XSAccessor

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'";
+}
+
+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
+        );
+    }
+}
+