blib/lib/ASPEER/MakeMaker/Markdown/Publish.pm

filter: Statementstmt 100% 30 / 30 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 95.1% 39 / 41 CC 1 SCAR 0.0
CC
1
Cov
94%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/ASPEER/MakeMaker/Markdown/Publish/MM/Constant.pm ↑ Summary
1 #
2 # This file is part of ASPEER::MakeMaker::Markdown::Publish.
3 #
4 # This software is copyright (c) 2026 by Andrew Speer <andrew.speer@isolutions.com.au>.
5 #
6 # This is free software; you can redistribute it and/or modify it under
7 # the same terms as the Perl 5 programming language system itself.
8 #
9 # Full license text is available at:
10 #
11 # <http://dev.perl.org/licenses/>
12 #
13 package ASPEER::MakeMaker::Markdown::Publish;
14  
15  
16 # Compiler pragma and package variables
17 #
18 1 ▶use strict qw(vars);
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use vars qw($VERSION $VERSION_GIT_SHA $AUTHORITY @ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22  
23 # Inherit the shared MakeMaker hook implementation. Actual site assembly and
24 # publication remains in the backend-neutral publishing module.
25 #
26 1 ▶use ASPEER::MakeMaker ();
Subroutine BEGIN: called CC=1 SCAR=0.0
27 1 ▶use ASPEER::MakeMaker::Markdown::Pod ();
Subroutine BEGIN: called CC=1 SCAR=0.0
28 1 ▶use ASPEER::MakeMaker::Markdown::Publish::MM ();
Subroutine BEGIN: called CC=1 SCAR=0.0
29 1 @ISA=qw(ASPEER::MakeMaker);
30  
31  
32 # Version information
33 #
34 1 $AUTHORITY='cpan:ASPEER';
35 1 $VERSION='1.003';
36 1 ▶$VERSION_GIT_SHA=do {local(@ARGV, $/, $_); @ARGV=($_=__FILE__.'.sha'); <> if -f $_};
Branch: 1 branch
BranchTrueFalseTotal
if -f $_ 0 1 1
37 1 ▶chomp($VERSION_GIT_SHA) if defined($VERSION_GIT_SHA);
Branch: 1 branch
BranchTrueFalseTotal
if defined $ASPEER::MakeMaker::Markdown::Publish::VERSION_GIT_SHA 0 1 1
38  
39  
40 # Done
41 #
42 1 1;
43  
44  
45 #======================================================================================================================
46  
47 1 ▶sub import {
Subroutine import: called CC=1 SCAR=0.0
48  
49  
50 # Install documentation maintenance before wrapping the same MakeMaker
51 # sections with publication targets.
52 #
53 1 my ($class, @section)=@_;
54 1 ASPEER::MakeMaker::Markdown::Pod->import(@section);
55 1 return ASPEER::MakeMaker::import($class, @section);
56  
57 }
58  
59 __END__
60  
61 =begin markdown
62  
63 # NAME
64  
65 ASPEER::MakeMaker::Markdown::Publish - MakeMaker targets for Markdown publication
66  
67 # SYNOPSIS
68  
69 ```perl
70 use ExtUtils::MakeMaker;
71 use ASPEER::MakeMaker::Markdown::Publish;
72  
73 WriteMakefile(
74 NAME => 'Example',
75 VERSION_FROM => 'lib/Example.pm',
76 META_MERGE => {
77 'meta-spec' => {version => 2},
78 x_documentation => {
79 publish => {
80 module => 'Markdown::Publish::MkDocs',
81 sources => ['doc'],
82 config => 'doc/mkdocs/mkdocs.yml',
83 },
84 },
85 },
86 );
87 ```
88  
89 # DESCRIPTION
90  
91 This is a thin MakeMaker adapter. It reads `META_MERGE.x_documentation.publish`
92 from the live `WriteMakefile` arguments and passes the settings to
93 `Markdown::Publish` when a target is invoked. It does not assemble
94 documents, run a publishing engine, or update Git itself.
95  
96 Importing this module also imports `ASPEER::MakeMaker::Markdown::Pod`, so the
97 generated Makefile includes its `doc` and `readme` maintenance targets alongside
98 the publication targets. The equivalent command-line activation is:
99  
100 ```text
101 perl -MASPEER::MakeMaker::Markdown::Publish Makefile.PL
102 ```
103  
104 The selected `module` is one of `Markdown::Publish::MkDocs`,
105 `::VitePress`, `::Docusaurus`, or `::Starlight`. One engine is active at a
106 time. Its `config` and other engine-specific options are top-level values
107 in the `publish` hash. Alternatively, set only `config_file` to a JSON file
108 containing the selected `module` and settings. That file is read when the
109 target runs, so edits do not require a regenerated Makefile.
110  
111 Configuration supplied inline is encoded into the generated Makefile. The
112 targets do not re-run `Makefile.PL` to discover it.
113  
114 # TARGETS
115  
116 ```text
117 doc
118 readme
119 publish_build
120 publish_serve
121 publish_gh
122 publish_gh-push
123 publish_cloudflare
124 ```
125  
126 `publish_build` prepares and renders the site. `publish_serve` starts the
127 selected engine's foreground local server. `publish_gh` builds, updates the
128 local publication branch, and does not contact a remote. `publish_gh-push`
129 performs the same operation, then pushes only that branch to `origin` without
130 forcing it. `publish_cloudflare`
131 builds and deploys the same site as Workers Static Assets using an authored
132 Wrangler configuration. Git branch publication and Cloudflare deployment are
133 independent; neither calls the other.
134  
135 # CONFIGURATION
136  
137 MkDocs is used when `module` is omitted. Set `module` in
138 `META_MERGE.x_documentation.publish` to select another engine, or set
139 `MARKDOWN_PUBLISH_MODULE` to override it at runtime.
140  
141 Without `sources`, an existing `doc/` is the publication boundary. Only when
142 `doc/` is absent are module and executable sidecars the default. An explicit
143 `sources` list is exact. `output`, `name`, `base`, and `branch` are common settings;
144 see the selected engine module for its own options. For generated engine
145 configuration, `name` defaults to the `NAME` supplied to `WriteMakefile`. Set
146 it explicitly for a friendlier site title:
147  
148 ```perl
149 publish => {
150 name => 'Example documentation',
151 },
152 ```
153  
154 An external `config_file` or an authored engine configuration remains
155 authoritative for its own site title.
156  
157 For generated VitePress, Docusaurus, and Starlight configuration, `base` sets
158 the deployment path and must begin and end with `/`. When it is omitted,
159 `publish_gh` derives `/<repository>/` from the `origin` repository name, or
160 uses `/` for an `<owner>.github.io` repository. The inferred value applies
161 only to the GitHub Pages build. Set `base` explicitly when the published URL
162 uses a different path; authored engine configuration remains authoritative.
163  
164 ```perl
165 publish => {
166 module => 'Markdown::Publish::VitePress',
167 base => '/example/',
168 },
169 ```
170  
171 Set `config_extend` to customise the selected engine's generated configuration
172 without replacing it. It is passed unchanged to `Markdown::Publish` and
173 cannot be combined with `config`. MkDocs accepts supplemental YAML; the Node
174 publishers accept the extension functions documented by their engine modules.
175  
176 For Workers Static Assets, set `cloudflare => {config => 'wrangler.jsonc'}`
177 inside `publish`. This path selects a dedicated Worker configuration with its
178 name and compatibility date. Optionally set `wrangler` to the executable path
179 or `environment` to an authored Wrangler environment in the same `cloudflare`
180 hash. Wrangler uses its own login or environment for authentication; do not
181 put credentials in metadata. Deployment does not change Git.
182  
183 # ERRORS
184  
185 `x_documentation` and `x_documentation.publish` must be hash references when
186 supplied. Invalid configuration and failed target actions are fatal.
187  
188 # SEE ALSO
189  
190 `Markdown::Publish`, `ASPEER::MakeMaker::Markdown::Pod`
191  
192 # AUTHOR
193  
194 Andrew Speer <andrew.speer@isolutions.com.au>
195  
196 # LICENSE and COPYRIGHT
197  
198 This file is part of ASPEER::MakeMaker::Markdown::Publish.
199  
200 This software is copyright (c) 2026 by Andrew Speer <andrew.speer@isolutions.com.au>.
201  
202 This is free software; you can redistribute it and/or modify it under
203 the same terms as the Perl 5 programming language system itself.
204  
205 Full license text is available at:
206  
207 <http://dev.perl.org/licenses/>
208  
209  
210 =end markdown
211  
212  
213 =head1 NAME
214  
215 ASPEER::MakeMaker::Markdown::Publish - MakeMaker targets for Markdown publication
216  
217  
218 =head1 SYNOPSIS
219  
220  
221 use ExtUtils::MakeMaker;
222 use ASPEER::MakeMaker::Markdown::Publish;
223  
224 WriteMakefile(
225 NAME => 'Example',
226 VERSION_FROM => 'lib/Example.pm',
227 META_MERGE => {
228 'meta-spec' => {version => 2},
229 x_documentation => {
230 publish => {
231 module => 'Markdown::Publish::MkDocs',
232 sources => ['doc'],
233 config => 'doc/mkdocs/mkdocs.yml',
234 },
235 },
236 },
237 );
238  
239 =head1 DESCRIPTION
240  
241 This is a thin MakeMaker adapter. It reads C<META_MERGE.x_documentation.publish>
242 from the live C<WriteMakefile> arguments and passes the settings to
243 C<Markdown::Publish> when a target is invoked. It does not assemble
244 documents, run a publishing engine, or update Git itself.
245  
246 Importing this module also imports C<ASPEER::MakeMaker::Markdown::Pod>, so the
247 generated Makefile includes its C<doc> and C<readme> maintenance targets alongside
248 the publication targets. The equivalent command-line activation is:
249  
250  
251 perl -MASPEER::MakeMaker::Markdown::Publish Makefile.PL
252 The selected C<module> is one of C<Markdown::Publish::MkDocs>,
253 C<::VitePress>, C<::Docusaurus>, or C<::Starlight>. One engine is active at a
254 time. Its C<config> and other engine-specific options are top-level values
255 in the C<publish> hash. Alternatively, set only C<config_file> to a JSON file
256 containing the selected C<module> and settings. That file is read when the
257 target runs, so edits do not require a regenerated Makefile.
258  
259 Configuration supplied inline is encoded into the generated Makefile. The
260 targets do not re-run C<Makefile.PL> to discover it.
261  
262  
263 =head1 TARGETS
264  
265  
266 doc
267 readme
268 publish_build
269 publish_serve
270 publish_gh
271 publish_gh-push
272 publish_cloudflare
273 C<publish_build> prepares and renders the site. C<publish_serve> starts the
274 selected engine's foreground local server. C<publish_gh> builds, updates the
275 local publication branch, and does not contact a remote. C<publish_gh-push>
276 performs the same operation, then pushes only that branch to C<origin> without
277 forcing it. C<publish_cloudflare>
278 builds and deploys the same site as Workers Static Assets using an authored
279 Wrangler configuration. Git branch publication and Cloudflare deployment are
280 independent; neither calls the other.
281  
282  
283 =head1 CONFIGURATION
284  
285 MkDocs is used when C<module> is omitted. Set C<module> in
286 C<META_MERGE.x_documentation.publish> to select another engine, or set
287 C<MARKDOWN_PUBLISH_MODULE> to override it at runtime.
288  
289 Without C<sources>, an existing C<doc/> is the publication boundary. Only when
290 C<doc/> is absent are module and executable sidecars the default. An explicit
291 C<sources> list is exact. C<output>, C<name>, C<base>, and C<branch> are common settings;
292 see the selected engine module for its own options. For generated engine
293 configuration, C<name> defaults to the C<NAME> supplied to C<WriteMakefile>. Set
294 it explicitly for a friendlier site title:
295  
296  
297 publish => {
298 name => 'Example documentation',
299 },
300 An external C<config_file> or an authored engine configuration remains
301 authoritative for its own site title.
302  
303 For generated VitePress, Docusaurus, and Starlight configuration, C<base> sets
304 the deployment path and must begin and end with C</>. When it is omitted,
305 C<publish_gh> derives C<<< /<repository>/ >>> from the C<origin> repository name, or
306 uses C</> for an C<<< <owner>.github.io >>> repository. The inferred value applies
307 only to the GitHub Pages build. Set C<base> explicitly when the published URL
308 uses a different path; authored engine configuration remains authoritative.
309  
310  
311 publish => {
312 module => 'Markdown::Publish::VitePress',
313 base => '/example/',
314 },
315 Set C<config_extend> to customise the selected engine's generated configuration
316 without replacing it. It is passed unchanged to C<Markdown::Publish> and
317 cannot be combined with C<config>. MkDocs accepts supplemental YAML; the Node
318 publishers accept the extension functions documented by their engine modules.
319  
320 For Workers Static Assets, set C<<< cloudflare => {config => 'wrangler.jsonc'} >>>
321 inside C<publish>. This path selects a dedicated Worker configuration with its
322 name and compatibility date. Optionally set C<wrangler> to the executable path
323 or C<environment> to an authored Wrangler environment in the same C<cloudflare>
324 hash. Wrangler uses its own login or environment for authentication; do not
325 put credentials in metadata. Deployment does not change Git.
326  
327  
328 =head1 ERRORS
329  
330 C<x_documentation> and C<x_documentation.publish> must be hash references when
331 supplied. Invalid configuration and failed target actions are fatal.
332  
333  
334 =head1 SEE ALSO
335  
336 C<Markdown::Publish>, C<ASPEER::MakeMaker::Markdown::Pod>
337  
338  
339 =head1 AUTHOR
340  
341 Andrew Speer L<mailto:andrew.speer@isolutions.com.au>
342  
343  
344 =head1 LICENSE AND COPYRIGHT
345  
346 This file is part of ASPEER::MakeMaker::Markdown::Publish. Copyright (c) 2026
347 Andrew Speer. This is free software; you can redistribute it and/or modify it
348 under the same terms as Perl 5.
349  
350 =cut
« blib/lib/ASPEER/MakeMaker/Markdown/Publish/MM/Constant.pm ↑ Summary