File tree Expand file tree Collapse file tree 2 files changed +107
-0
lines changed
Expand file tree Collapse file tree 2 files changed +107
-0
lines changed Original file line number Diff line number Diff line change @@ -12,3 +12,58 @@ use App::CPANModuleSite;
1212my $app = App::CPANModuleSite->new($ARGV[0]);
1313
1414$app->run;
15+
16+ =head1 NAME
17+
18+ mksite - Generate a web site for a CPAN module
19+
20+ =head1 SYNOPSIS
21+
22+ $ mksite My::Lovely::Module
23+
24+ =head1 DESCRIPTION
25+
26+ This program will automatically generate a web site for a CPAN module
27+ (actually, it's more accurate to say a CPAN distribution). It gets the
28+ information used to create the site from two sources:
29+
30+ =over 4
31+
32+ =item * It uses the MetaCPAN API to get data about the distribution.
33+
34+ =item * It uses templates and other files that can be stored in the code
35+ repository for the distribution.
36+
37+ =back
38+
39+ Note that the first of these items creates a tiny caveat as you can only use
40+ this module to create sites for distributions that the MetaCPAN API knows about
41+ - i.e. distributions that have been released to CPAN.
42+
43+ =head1 TODO
44+
45+ This documentation needs a lot of expansion. I'll be doing that over the
46+ next few weeks.
47+
48+ =head1 AUTHOR
49+
50+ Dave Cross <dave@perlhacks.com>
51+
52+ =head1 SEE ALSO
53+
54+ =over 4
55+
56+ =item * L<Perl Modules with their own web sites|https://dev.to/szabgab/perl-modules-with-their-own-web-site-2gmo>
57+
58+ =item * L<Simple CPAN module web sites with GitHub Pages|https://dev.to/davorg/simple-cpan-module-web-sites-with-github-pages-29ka>
59+
60+ =back
61+
62+ =head1 COPYRIGHT AND LICENSE
63+
64+ Copyright (C) 2021, Magnum Solutions Ltd. All Rights Reserved.
65+
66+ This script is free software; you can redistribute it and/or modify it
67+ under the same terms as Perl itself.
68+
69+ =cut
Original file line number Diff line number Diff line change 22
33App::CPANModuleSite - Automatically create a web site for a CPAN module.
44
5+ =head1 SYNOPSIS
6+
7+ # From a command line
8+ $ mksite My::Lovely::Module
9+
10+ It's probably not particularly useful to use the class directly.
11+
512=cut
613
714package App::CPANModuleSite ;
@@ -13,6 +20,7 @@ use v5.14;
1320use MetaCPAN::Client;
1421use Template;
1522use Path::Iterator::Rule;
23+ use File::Copy;
1624use Moose;
1725use Moose::Util::TypeConstraints;
1826use File::ShareDir ' dist_dir' ;
@@ -171,6 +179,26 @@ around BUILDARGS => sub {
171179 }
172180};
173181
182+ =head1 METHODS
183+
184+ =head2 run
185+
186+ The main driver method for the class. Does the following steps:
187+
188+ =over 4
189+
190+ =item * Creates a list of input files
191+
192+ =item * Uses Template Toolkit to process the templates
193+
194+ =item * Copies any non-template files into the output tree
195+
196+ =item * Creates a HTML version of the Pod from all the modules
197+
198+ =back
199+
200+ =cut
201+
174202sub run {
175203 my $self = shift ;
176204
@@ -205,4 +233,28 @@ sub process_template {
205233 or die $self -> tt-> error;
206234}
207235
236+ sub copy_file {
237+ my $self = shift ;
238+ my ($file ) = @_ ;
239+
240+ copy($file , $self -> output_path . " /$file " );
241+ }
242+
2082431;
244+
245+ =head1 AUTHOR
246+
247+ Dave Cross <dave@perlhacks.com>
248+
249+ =head1 SEE ALSO
250+
251+ L<mksite>
252+
253+ =head1 COPYRIGHT AND LICENSE
254+
255+ Copyright (C) 2021, Magnum Solutions Ltd. All Rights Reserved.
256+
257+ This script is free software; you can redistribute it and/or modify it
258+ under the same terms as Perl itself.
259+
260+ =cut
You can’t perform that action at this time.
0 commit comments