Permalink
Browse files

Add cpanmcover script.

To run cpancover on cpanm installation directories.
  • Loading branch information...
1 parent 5459bf2 commit d71d090c5f11909e35ec5fdeba61bd257a932c7e @pjcj committed May 23, 2012
Showing with 37 additions and 0 deletions.
  1. +37 −0 utils/cpanmcover
View
@@ -0,0 +1,37 @@
+#!/usr/bin/perl
+
+# Copyright 2012, Paul Johnson (paul@pjcj.net)
+
+# This software is free. It is licensed under the same terms as Perl itself.
+
+# The latest version of this software should be available from my homepage:
+# http://www.pjcj.net
+
+use strict;
+use warnings;
+
+my $moddir = glob "~/.cpanm/work";
+my $covdir = glob "~/cpancover";
+my $lnkdir = "$covdir/modules";
+my $resdir = "$covdir/results";
+
+mkdir $covdir, 0750 unless -d $covdir;
+mkdir $lnkdir, 0750 unless -d $lnkdir;
+mkdir $resdir, 0750 unless -d $resdir;
+
+for my $d (grep -d, <$moddir/*/*>)
+{
+ print "Linking $d\n";
+ my ($e) = $d =~ m|/([^/]+)$| or die "Can't find module name";
+ my $new = "$lnkdir/$e";
+ unlink $new if -e $new;
+ symlink $d => $new;
+}
+
+my $c;
+$c .= "cpancover -directory $lnkdir -outputdir $covdir/results ";
+$c .= "-outputfile index.html -report html_basic";
+# $c .= " -force";
+# $c .= " -redo_html";
+print "running [$c]\n";
+system $c;

0 comments on commit d71d090

Please sign in to comment.