Skip to content

Commit

Permalink
normalize version numbers and use App::RewriteVersion in tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
Grinnz committed Jun 5, 2018
1 parent aa1124b commit f9361f2
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 13 deletions.
3 changes: 1 addition & 2 deletions Build.PL
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use strict;

# Include 'lib' so it sees our perl5i::VERSION when version checking
use lib 'inc', 'lib';
use lib 'inc';
use MyBuild;

use 5.010;
Expand All @@ -12,7 +12,6 @@ my $builder = MyBuild->new(
module_name => 'perl5i',
license => 'perl',
dist_author => 'Michael G Schwern <[email protected]>',
dist_version => "v2.13.2",

requires => {
'perl' => '5.10.0',
Expand Down
7 changes: 4 additions & 3 deletions admin/change_version
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/perl
#!/usr/bin/env perl

use App::RewriteVersion;

my $version = shift;
die "$0 <version>\n" unless $version;
system qq[perl -i -pe 's{(dist_version \\s* => \\s*) \\S+ (.*)}{\$1"v$version",}x' Build.PL];
system qq[perl -i -pe 's{v[.\\d_]+}{v$version}' lib/perl5i/VERSION.pm];
App::RewriteVersion->new(verbose => 1)->rewrite_versions($version);

5 changes: 3 additions & 2 deletions admin/new_major_version
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/env perl

$new_version = shift || die "$0 <new version>\n";
$old_version = $new_version - 1;
Expand All @@ -13,7 +13,8 @@ run(qq[find lib/perl5i/$new_version -type f -print0 | xargs -0 $change_version])
run("$change_version lib/perl5i/{Meta,VERSION,latest,$new_version}.pm lib/*.pm lib/*.pod");

# Change the distribution version number to $new.0.0
run(qq[perl -i -pe 's{v$old_version [.\\d]+}{v$new_version.0.0}x' lib/perl5i/VERSION.pm Build.PL]);
use App::RewriteVersion;
App::RewriteVersion->new(verbose => 1)->rewrite_versions("v${new_version}.0.0");

sub run {
my @cmd = @_;
Expand Down
2 changes: 1 addition & 1 deletion lib/perl5i.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package perl5i;
use strict;
use parent 'perl5i::latest';

use perl5i::VERSION; our $VERSION = perl5i::VERSION->VERSION;
our $VERSION = 'v2.13.2';

my $Latest = perl5i::VERSION->latest;

Expand Down
2 changes: 1 addition & 1 deletion lib/perl5i/0.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use perl5i::0::Meta;
use autobox;
use Encode ();

use perl5i::VERSION; our $VERSION = perl5i::VERSION->VERSION;
our $VERSION = 'v2.13.2';

our $Latest = 'perl5i::0';

Expand Down
2 changes: 1 addition & 1 deletion lib/perl5i/1.pm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use perl5i::1::Meta;
use Encode ();
use perl5i::1::autobox;

use perl5i::VERSION; our $VERSION = perl5i::VERSION->VERSION;
our $VERSION = 'v2.13.2';

our $Latest = 'perl5i::1';

Expand Down
3 changes: 2 additions & 1 deletion lib/perl5i/2.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ use Carp::Fix::1_25;
use perl5i::2::autobox;
use Import::Into;

use perl5i::VERSION; our $VERSION = perl5i::VERSION->VERSION;
our $VERSION = 'v2.13.2';

use perl5i::VERSION;
our $Latest = perl5i::VERSION->latest;

my %Features = (
Expand Down
2 changes: 1 addition & 1 deletion lib/perl5i/VERSION.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package perl5i::VERSION;
use strict;
use warnings;

use version 0.77; our $VERSION = qv("v2.13.2");
our $VERSION = 'v2.13.2';

sub latest { "perl5i::2" }; # LATEST HERE (for automated update)

Expand Down
3 changes: 2 additions & 1 deletion lib/perl5i/latest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package perl5i::latest;
use strict;
use warnings;

use perl5i::VERSION; our $VERSION = perl5i::VERSION->VERSION;
our $VERSION = 'v2.13.2';

my $Latest;
use perl5i::VERSION;
BEGIN { $Latest = perl5i::VERSION->latest; }

use parent ($Latest);
Expand Down

0 comments on commit f9361f2

Please sign in to comment.