HiD/Generator.pm

filter: Statementstmt 84.3% 27 / 32 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod n/a totaltotal 81.4% 35 / 43 CC 2 SCAR 6.9
CC
2
Cov
79%
_create_destination_directory_if_needed
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« HiD/App/Command.pm ↑ Summary HiD/VirtualPage.pm »
1 # ABSTRACT: Base class for generators
2  
3  
4 package HiD::Generator;
5 6 our $AUTHORITY = 'cpan:GENEHACK';
6 6 $HiD::Generator::VERSION = '1.96';
7 6 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 6 ▶use 5.014; # strict, unicode_strings
Subroutine BEGIN: called CC=1 SCAR=0.0
10 6 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 6 ▶use autodie;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 6 ▶use warnings qw/ FATAL utf8 /;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 6 ▶use charnames qw/ :full /;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 6 ▶use Path::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 6 requires 'generate';
18  
19  
20 sub _create_destination_directory_if_needed {
21 0 ▶ my( $self , $dest ) = @_;
Subroutine _create_destination_directory_if_needed: not called CC=2 SCAR=17.9
22  
23 0 $dest = path( $dest );
24  
25 0 ▶ $self->FATAL( "'$dest' exists and is not a directory!" )
Branch: 1 branch
BranchTrueFalseTotal
if $dest->is_file 0 0 0
26 if $dest->is_file;
27  
28 0 $dest->mkpath;
29  
30 0 return 1;
31 }
32  
33 6 ▶no Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 6 1;
35  
36 __END__
37  
38 =pod
39  
40 =encoding UTF-8
41  
42 =head1 NAME
43  
44 HiD::Generator - Base class for generators
45  
46 =head1 DESCRIPTION
47  
48 Role for generator objects
49  
50 See L<http://jekyllrb.com/docs/plugins/#generators> for more details. The HiD
51 implementation differs somewhat, particularly in supporting additional plugin
52 functionality in a post-publication phase (see L<HiD::Plugin>), but generators
53 should still be used for things that need to modify content or inject new
54 programatically generated objects into the publication process.
55  
56 Generator objects should consume this role, and implement the C<generate>
57 method that it requires. This method will be passed the C<$site> object from
58 L<HiD>. Pages to be generated are in C<< $site->pages >>, posts are in C<<
59 $site->posts >> and so on.
60  
61 =head1 METHODS
62  
63 =head2 generate
64  
65 =head1 VERSION
66  
67 version 1.96
68  
69 =head1 AUTHOR
70  
71 John SJ Anderson <genehack@genehack.org>
72  
73 =head1 COPYRIGHT AND LICENSE
74  
75 This software is copyright (c) 2015 by John SJ Anderson.
76  
77 This is free software; you can redistribute it and/or modify it under
78 the same terms as the Perl 5 programming language system itself.
79  
80 =cut
« HiD/App/Command.pm ↑ Summary HiD/VirtualPage.pm »