Created
July 17, 2017 18:37
-
-
Save theory/52353b6d8b97b9d642c46df8a4dc95ef to your computer and use it in GitHub Desktop.
Simple script to update the version of a Perl distribution.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -pi | |
BEGIN { | |
die "Usage: $0 version[, new_version]\n\n" unless @ARGV; | |
$old = shift; | |
$new = shift || sprintf('%.2f', $old + .01); | |
$dir = shift || '.'; | |
@ARGV = | |
map { print; chomp; $_ } | |
grep !( /\.(?:svn|git)/ or /Change/ or /META\.yml/ or /Makefile\.PL/ or /blib/), | |
`grep -lr '\Q$old\E' $dir`; | |
} | |
s/((?:(?:\$|::|[.]|PGTAP_)VERSION\s*=?\s*|package\s+\S+)\s+'?)\Q$old\E('?)/${1}$new$2/g; | |
#s/(\s+version\s+)\Q$old\E$/$1$new/; # For README. | |
s/\b\Q$old\E$/$new/; # For README.pgtap. | |
__END__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment