httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Schaefer <joe+gm...@sunstarsys.com>
Subject Re: [PROPOSAL] docs, tables, tests (was: Re: separate pod files for Apache:: packages)
Date Tue, 20 Jul 2004 04:09:29 GMT
Joe Schaefer <joe+gmane@sunstarsys.com> writes:

[...]

> Right- I guess we could also use the ./docs subdir to hold the 
> .t files Test::Inline generates, and add a "test" target to the 
> MY::postamble sub above to include them in a `make test` run.

Here's a patch that accomplishes this for *nix, but it
uses a Makefile pattern (%.t: %.pod) which may be gnu-specific.
Just make a dummy glue/perl/docs/Error.pod file to start
playing with Inline::Test.  I'll move the existing docs over
to this directory and commit the changes in a day or two, unless 
someone has a better idea?

Index: glue/perl/Makefile.PL
===================================================================
RCS file: /home/cvs/httpd-apreq-2/glue/perl/Makefile.PL,v
retrieving revision 1.9
diff -u -r1.9 Makefile.PL
--- glue/perl/Makefile.PL       30 Oct 2003 01:22:00 -0000      1.9
+++ glue/perl/Makefile.PL       20 Jul 2004 04:04:10 -0000
@@ -11,6 +11,8 @@
 use Apache::TestRun ();
 use Apache::TestConfigPerl ();
 use File::Find qw(finddepth);
+use File::Spec::Functions qw(catdir);
+
 my @scripts = ();

 {
@@ -34,5 +36,47 @@
     clean => { FILES => "xs t/logs t/TEST @scripts" },
     realclean => { FILES => "xsbuilder/tables" },
 );
+
+
+sub copy_docs {
+    my @lines;
+    my $dfs = '$(DIRFILESEP)';
+
+    foreach my $file (@_) {
+        my @dirs;
+        $file =~ /(\w+\.pod)$/ or next;
+        if ($1 eq "Error.pod" or $1 eq "Table.pod") {
+            push @dirs, catdir("Apache", $_) for qw/Request Cookie Upload/;
+        }
+        else {
+            push @dirs, "Apache";
+        }
+        push @lines, map <<EOT, @dirs;
+subdirs :: \$(INST_LIBDIR)$dfs$_$dfs$1
+\$(INST_LIBDIR)$dfs$_$dfs$1: $file
+       \$(NOECHO) \$(MKPATH) \$(INST_LIBDIR)$dfs$_
+       \$(CP) $file \$(INST_LIBDIR)$dfs$_$dfs$1
+
+EOT
+    }
+    return join "", @lines;
+}
+
+sub MY::postamble {
+    my @docs = <docs/*.pod>;
+    my @tests = @docs;
+    s/pod$/t/ for @tests;
+
+    return copy_docs(@docs) . sprintf <<'EOT', "@tests";
+%%.t : %%.pod
+       pod2test $< $@
+
+doc_test : %s
+       $(FULLPERL) -Mblib -MTest::Harness -e 'runtests(@ARGV)' $^
+
+test :: doc_test
+
+EOT
+}

 __END__


-- 
Joe Schaefer


Mime
View raw message