Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

improved mkdist

  • Loading branch information...
commit 3c54751d667ee8bd66d6f6125490126e27bf91a5 1 parent c6aa48c
@russoz authored
Showing with 29 additions and 37 deletions.
  1. +29 −37 dev/mkdist
View
66 dev/mkdist
@@ -25,65 +25,59 @@ is_dry_run && {
msg "***** DRY-RUN: use -f to actually commit! *****"
}
-msg "== Running ./Build.PL"
-perl ./Build.PL || exit 1
+_tidy() {
+ dir="$1"; shift
+ spec="$1"; shift
-msg "== Running tests"
-./Build disttest || exit 1
+ eval "find $dir -name '$spec' | xargs perltidy -b"
+}
msg "== Running through perltidy"
-{
- find lib/ -name '*.pm' | xargs perltidy -b \
- && find t/ -name '*.t' | xargs perltidy -b
-} || {
+{ _tidy lib/ '*.pm' && _tidy t/ '*.t' && _tidy ./ '*.[Pp][Ll]'; } || {
msg "**** Failed syntax check! Aborting."
exit 1
}
-msg "== Adding module to git"
-is_dry_run || git add lib/${modulepath}
-
-msg "== Making README"
-( readme=../README
- is_dry_run && readme=/dev/null
- cd lib; perldoc -t -F ${modulepath} > ${readme} ) \
- || exit 1
-is_dry_run || git add README
+msg "== Running ./Build.PL"
+perl ./Build.PL || exit 1
-msg "== Creating META.yml"
-./Build distmeta || exit 1
+msg "== Running tests"
+./Build disttest || exit 1
version=$(perl -nle 'if( /^version/ ) { s/^\S+\s+v//; print; }' META.yml)
msg "== Version: ${version}"
-msg "== Generating <Changes> automagically"
+msg "== Adding module to git"
+is_dry_run || { git add lib/${modulepath} || exit 1; }
+
+msg "== Making README"
+( cd lib; perldoc -t -F ${modulepath} > ../__readme ) || exit 1
+is_dry_run || { cp __readme README && git add README || exit 1; }
+
+msg "== Checking <Changes> file for this version"
grep -q "^${version}" Changes && {
msg "**** VERSION ${version} is already in Changes. Aborting..."
exit 1
}
-changes=Changes
-is_dry_run && changes=/dev/tty
-cp Changes __changes && {
+
+msg "== Generating <Changes> automagically"
+{
echo "Revision history for ${moduledash}"
echo ""
- printf '%-7s %s %s\n' "${version}" "$(date +%d.%m.%Y)" \
+ printf '%-7s [%s] %s\n' "${version}" "$(date '+%Y.%m.%d %H:%M:%S')" \
"${modulename} DIST VERSION ${version}"
- perl -e 'print "="x7 . " " . "="x70 . "\n"'
+ perl -e 'print "="x7 . " " . "="x78 . "\n"'
git log --oneline | perl -nle 'exit if /DIST VERSION/; print "$_";' &&
echo "" &&
- cat __changes | perl -e '$a=<>; $a=<>; while(<>) { print }'
-} > ${changes} \
- || exit 1
-is_dry_run || {
- head -20 Changes
- git add Changes
-}
+ cat Changes | perl -e '$a=<>; $a=<>; while(<>) { print }'
+} | tee __changes | head -20 || exit 1
+is_dry_run || { cp __changes Changes && git add Changes || exit 1; }
msg "== Committing files to git"
-is_dry_run || git commit -m "DIST VERSION ${version}" || exit 1
+is_dry_run || { git commit -m "DIST VERSION ${version}" || exit 1; }
msg "== Tagging as v${version}"
-is_dry_run || git tag v${version} HEAD || exit 1
+is_dry_run || { git tag v${version} HEAD || exit 1; }
msg "== Making distribution package"
./Build dist || exit 1
@@ -95,7 +89,5 @@ is_dry_run || mv $d ${HOME}
msg "== Cleaning directory"
is_dry_run || git clean -fd
-is_dry_run && {
- msg "***** DRY-RUN: use -f to actually commit! *****"
-}
+is_dry_run && { msg "***** DRY-RUN: use -f to actually commit! *****"; }
Please sign in to comment.
Something went wrong with that request. Please try again.