Created
February 18, 2015 06:19
-
-
Save s1037989/7b388a4d01e2cd568bbb to your computer and use it in GitHub Desktop.
CPAN release and bump version
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
Needs some error handling. | |
release () | |
{ | |
NAME=$(perl -p -E '$_ = /^\s*NAME\s*/ ? eval("{$_}")->{NAME} : undef' Makefile.PL); | |
VERSION_FROM=$(perl -p -E '$_ = /^\s*VERSION_FROM\s*/ ? eval("{$_}")->{VERSION_FROM} : undef' Makefile.PL); | |
CV=$(perl -E "require '$VERSION_FROM'; say \$$NAME::VERSION"); | |
BV=$(perl -E "require '$VERSION_FROM'; say \$$NAME::VERSION+0.01"); | |
rm -f Mojolicious-Plugin-MimeTypes-*.tar.gz; | |
git tag $CV; | |
make realclean; | |
perl Makefile.PL && make && make test && make manifest && make dist; | |
bump_version $CV $BV; | |
echo mojo cpanify -u user -p pass tar.gz | |
} | |
bump_version () | |
{ | |
sed -i '1i '$2' '$(date +%Y-%m-%d)'\n' Changes; | |
sed -i 's/our $VERSION = '\'$1\'';/our $VERSION = '\'$2\'';/' $(perl -p -E '$_=undef unless s/^VERSION_FROM = (.*)/$1/' Makefile); | |
git add Changes $(perl -p -E '$_=undef unless s/^VERSION_FROM = (.*)/$1/' Makefile); | |
git commit -m "bump version" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment