Created
August 14, 2013 05:28
-
-
Save waffle2k/6228243 to your computer and use it in GitHub Desktop.
Once I've manually tested a new build, I run this script to execute certain regression tests against it, then push it to my PAUSE account for indexing.
This file contains hidden or 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
#!/bin/bash | |
# | |
# This script is used to automate and move along the CPAN pipeline of | |
# module creation, and upload to CPAN. | |
set -e | |
function die { | |
echo "$1" | |
exit 1 | |
} | |
PID=$$ | |
if [ -e /tmp/$PID ]; then | |
die "The directory /tmp/$PID already exists - please remove it before proceding" | |
fi | |
if [ ! -e Makefile.PL ]; then | |
die "This doesn't appear to be a Makefile.PL controlled module - Exiting" | |
fi | |
# Register our cleanup trap | |
trap "rm -rf /tmp/$PID" EXIT | |
# Generate a distfile | |
echo "Generating distfile .." | |
perl Makefile.PL && make dist && make distclean || die 'Could not create distfile' | |
DISTFILE=$(ls -1rt *.tar.gz | tail -1) | |
mkdir -p /tmp/$PID/ | |
mv $DISTFILE /tmp/$PID/ | |
cd /tmp/$PID/ | |
tar zxpvf $DISTFILE | |
DIRNAME=$( echo $DISTFILE | awk -F".tar.gz" '{print $1}' ) | |
cd $DIRNAME || die "Could not cd to $DIRNAM" | |
fakeroot perl Makefile.PL && make test || die 'Failed regression tests' | |
echo "Uploading to PAUSE .." | |
make dist && cpan-upload $(cpan-upload-options) $(ls -1rt *.tar.gz | tail -1) || die 'Failed to upload to PAUSE' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment