[carton] 41/472: use the package name for Doc:: and auto generates pod2man doc files
Lucas Kanashiro
kanashiro-guest at moszumanska.debian.org
Fri Jul 24 00:38:30 UTC 2015
This is an automated email from the git hooks/post-receive script.
kanashiro-guest pushed a commit to branch master
in repository carton.
commit 8cbab2d5925db71e8d91ea59411aadfef56dc02e
Author: Tatsuhiko Miyagawa <miyagawa at bulknews.net>
Date: Sun Jun 26 09:20:21 2011 -0700
use the package name for Doc:: and auto generates pod2man doc files
---
.gitignore | 1 +
Makefile.PL | 40 +++++++++++++++++++++++++++++++++++-----
README | 3 ++-
lib/Carton/Doc/Carton.pod | 2 +-
lib/Carton/Doc/Install.pod | 2 +-
lib/Carton/Doc/List.pod | 2 +-
6 files changed, 41 insertions(+), 9 deletions(-)
diff --git a/.gitignore b/.gitignore
index e8c9eb7..145a373 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,5 +4,6 @@ Makefile
inc/
pm_to_blib
*~
+doc/
.carton/
local/
diff --git a/Makefile.PL b/Makefile.PL
index a97c8ad..b199f78 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -14,21 +14,51 @@ requires 'Try::Tiny';
install_script 'bin/carton';
-makemaker_args MAN1PODS => man1pods();
+doc_to_pods();
build_requires 'Test::More', 0.88;
test_requires 'Test::Requires';
auto_set_repository();
WriteAll;
-sub man1pods {
+sub doc_to_pods {
+ # lib/Carton/Doc/*.pod => doc/carton-*.pod => blib/man1/carton-*.1
+
my %pods;
for my $file (glob "lib/Carton/Doc/*.pod") {
- my $name = ($file =~ m!Doc/(.*?)\.pod!)[0];
- $name = $name eq 'Carton' ? "carton" : ("carton-" . lc($name));
- $pods{$file} = "blib/man1/$name.1"
+ my $base = ($file =~ m!Doc/(.*?)\.pod!)[0];
+ my $name = $base eq 'Carton' ? "carton" : ("carton-" . lc($base));
+ my $doc = "doc/$name.pod";
+
+ if ($Module::Install::AUTHOR) {
+ mkdir "doc", 0777;
+ copy_pod($file, $doc, "Carton::Doc::$base" => $name);
+ }
+
+ $pods{$doc} = "blib/man1/$name.1"
}
\%pods;
+
+ makemaker_args MAN1PODS => \%pods;
+}
+
+sub copy_pod {
+ my($src, $dest, $pod_name, $man) = @_;
+
+ warn "Copying $src -> $dest\n";
+
+ open my $in, "<", $src or die $!;
+ open my $out, ">", $dest or die $!;
+
+ my $match;
+ while (<$in>) {
+ s/^$pod_name - /$man - / and $match++;
+ print $out $_;
+ }
+
+ unless ($match) {
+ die "Could nto find NAME $pod_name in $src";
+ }
}
diff --git a/README b/README
index df4e28f..57cbaed 100644
--- a/README
+++ b/README
@@ -1,5 +1,6 @@
NAME
- carton - Perl module dependency manager (aka Bundler for Perl)
+ Carton::Doc::Carton - Perl module dependency manager (aka Bundler for
+ Perl)
SYNOPSIS
# During the development
diff --git a/lib/Carton/Doc/Carton.pod b/lib/Carton/Doc/Carton.pod
index 305dbf1..4831063 100644
--- a/lib/Carton/Doc/Carton.pod
+++ b/lib/Carton/Doc/Carton.pod
@@ -1,6 +1,6 @@
=head1 NAME
-carton - Perl module dependency manager (aka Bundler for Perl)
+Carton::Doc::Carton - Perl module dependency manager (aka Bundler for Perl)
=head1 SYNOPSIS
diff --git a/lib/Carton/Doc/Install.pod b/lib/Carton/Doc/Install.pod
index 1f5f8bc..8c93652 100644
--- a/lib/Carton/Doc/Install.pod
+++ b/lib/Carton/Doc/Install.pod
@@ -1,6 +1,6 @@
=head1 NAME
-carton-install - Install the dependencies
+Carton::Doc::Install - Install the dependencies
=head1 SYNOPSIS
diff --git a/lib/Carton/Doc/List.pod b/lib/Carton/Doc/List.pod
index 39c7d7e..adc768f 100644
--- a/lib/Carton/Doc/List.pod
+++ b/lib/Carton/Doc/List.pod
@@ -1,6 +1,6 @@
=head1 NAME
-carton-list - List dependencies tracked in the carton.lock file
+Carton::Doc::List - List dependencies tracked in the carton.lock file
=head1 SYNOPSIS
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/carton.git
More information about the Pkg-perl-cvs-commits
mailing list