Skip to content

Commit

Permalink
Sereal::Path: fixver-sp.pl
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Kruglov committed Feb 22, 2017
1 parent 34fe416 commit fd58556
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Perl/Path/MANIFEST.SKIP
@@ -1,3 +1,5 @@
fixver-sp.pl

# Avoid archives of this distribution
\bSereal-Path-[\d\.\_]+
\bSereal-Path-\.c$
Expand Down
50 changes: 50 additions & 0 deletions Perl/Path/fixver-sp.pl
@@ -0,0 +1,50 @@
use strict;
use warnings;
use Getopt::Long;

my @files= qw(
Iterator/lib/Sereal/Path/Iterator.pm
Tie/lib/Sereal/Path/Tie.pm
lib/Sereal/Path.pm
lib/Sereal/Path/Constants.pm
);

my $to= shift @ARGV;

die "usage: MAJOR.MINOR_(DEV) REASON" if !$to;
my $reason= join " ", @ARGV;
die "usage: $0 VERSION REASON" if !$reason;

my ($major,$minor,$dev)= split/[_.]/, $to;

$to= $dev ? sprintf "%d.%03d_%03d", $major, $minor, $dev
: sprintf "%d.%03d", $major, $minor
;

my %special= (
'Sereal/lib/Sereal.pm' => $to
);

foreach my $file (@files) {
open my $in, "<", $file
or die "Failed to open for read '$file': $!";
unlink $file;
open my $out, ">", $file
or die "Failed to open for write '$file': $!";
while (<$in>) {
s/\$VERSION\s*=\s*'[^']+'/\$VERSION = '$to'/g;
print $out $_;
}
}

print <<"EOF_TEXT";
git clean -fdx && perl Makefile.PL && make && make manifest && make disttest && make dist &&
git commit -a -m'Release Sereal::Path v$to - $reason' &&
git tag Sereal-Path-$to -m'Release Sereal::Path version $to ($reason)' &&
git push && git push --tags
cpan-upload -verbose Sereal-Path-$to.tar.gz
EOF_TEXT

0 comments on commit fd58556

Please sign in to comment.