# this will add the xt tests to the `make test` target among other things
Meta->tests(join (' ', map { $_ || () } Meta->tests, @xt_tests ) );
-# inject an explicit xt test run for the create_distdir target
+# inject an explicit xt test run, mainly to check the contents of
+# lib and the generated POD's *before* anything is copied around
postamble <<"EOP";
-create_distdir : test_xt
+dbic_clonedir_copy_generated_pod : test_xt
test_xt : pm_to_blib
@{[
}
+# generate the script/dbicadmin pod
+{
+ print "Regenerating script/dbicadmin.pod\n";
+
+ # generating it in the root of $pod_dir
+ # it will *not* be copied over due to not being listed at the top
+ # of MANIFEST.SKIP - this is a *good* thing
+ # we only want to ship a script/dbicadmin, with the POD appended
+ # (see inject_dbicadmin_pod.pl), but still want to spellcheck and
+ # whatnot the intermediate step
+ my $pod_fn = "$pod_dir/dbicadmin.pod";
+
+ # if the author doesn't have the prereqs, don't fail the initial "perl Makefile.pl" step
+ # therefore no error checking
+ system($^X, qw( -Ilib -- script/dbicadmin --documentation-as-pod ), $pod_fn);
+
+ postamble <<"EOP";
+
+clonedir_generate_files : dbic_clonedir_gen_dbicadmin_pod
+
+dbic_clonedir_gen_dbicadmin_pod :
+\t\$(ABSPERLRUN) -Ilib -- script/dbicadmin --documentation-as-pod @{[ $mm_proto->quote_literal($pod_fn) ]}
+
+EOP
+}
+
+
# generate the inherit pods both in the clone-dir and during the makefile distdir
{
print "Regenerating project documentation to include inherited methods\n";
- # if the author doesn't have them, don't fail the initial "perl Makefile.pl" step
+ # if the author doesn't have the prereqs, don't fail the initial "perl Makefile.pl" step
do "maint/gen_pod_inherit" or print "\n!!! FAILED: $@\n";
postamble <<"EOP";
-# Makefile syntax allows adding extra dep-specs for already-existing targets,
-# and simply appends them on *LAST*-come *FIRST*-serve basis.
-# This allows us to inject extra depenencies for standard EUMM targets
+# without having the pod in the file itself, perldoc may very
+# well show a *different* document, because perl and perldoc
+# search @INC differently (crazy right?)
+#
+# make sure we delete and re-create the file - just an append
+# will not do what one expects, because on unixy systems the
+# target is symlinked to the original
postamble <<"EOP";
create_distdir : dbic_distdir_dbicadmin_pod_inject
-# The pod self-injection code is in fact a hidden option in
-# dbicadmin itself, we execute the one in the distdir
dbic_distdir_dbicadmin_pod_inject :
-\t\$(ABSPERLRUN) -I\$(DISTVNAME)/lib \$(DISTVNAME)/script/dbicadmin --selfinject-pod
+
+\t\$(RM_F) \$(DISTVNAME)/script/dbicadmin
+\t@{[ $mm_proto->oneliner('cat', ['-MExtUtils::Command']) ]} script/dbicadmin maint/.Generated_Pod/dbicadmin.pod > \$(DISTVNAME)/script/dbicadmin
EOP
['delete' => 'Delete data from the schema'],
['op:s' => 'compatiblity option all of the above can be suppied as --op=<action>'],
['help' => 'display this help', { implies => { schema_class => '__dummy__' } } ],
- ['selfinject-pod' => 'hidden', { implies => { schema_class => '__dummy__' } } ],
+ ['documentation-as-pod:s' => 'hidden', { implies => { schema_class => '__dummy__' } } ],
], required => 1 }],
['Arguments'],
["configuration" => hidden => { one_of => [
)
);
-if($opts->{selfinject_pod}) {
-
- die "This is an internal method, do not call!!!\n"
- unless $ENV{MAKELEVEL};
-
- $usage->synopsis($synopsis_text);
- $usage->short_description($short_description);
- exec (
- $^X,
- qw/-p -0777 -i -e/,
- (
- 's/^# auto_pod_begin.*^# auto_pod_end/'
- . quotemeta($usage->pod)
- . '/ms'
- ),
- __FILE__
- );
+if(defined (my $fn = $opts->{documentation_as_pod}) ) {
+ $usage->synopsis($synopsis_text);
+ $usage->short_description($short_description);
+
+ if ($fn) {
+ require File::Spec;
+ require File::Path;
+ my $dir = File::Spec->catpath( (File::Spec->splitpath($fn))[0,1] );
+ File::Path::mkpath([$dir]);
+ }
+
+ local *STDOUT if $fn;
+ open (STDOUT, '>', $fn) or die "Unable to open $fn: $!\n" if $fn;
+
+ print STDOUT "\n";
+ print STDOUT $usage->pod;
+ print STDOUT "\n";
+
+ close STDOUT if $fn;
+ exit 0;
}
# FIXME - lowercasing will eventually go away when Getopt::Long::Descriptive is fixed
}
}
+1;
__END__
-
-# auto_pod_begin
-#
-# This will be replaced by the actual pod when selfinject-pod is invoked
-#
-# auto_pod_end
-
-# vim: et ft=perl