HiD/App/Command/publish.pm

filter: Statementstmt 92.8% 39 / 42 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod n/a totaltotal 89.6% 52 / 58 CC 4 SCAR 8.1
CC
4
Cov
88%
_run
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« HiD/VirtualPage.pm ↑ Summary HiD/App/Command/init.pm »
1 # ABSTRACT: publish site
2  
3  
4 package HiD::App::Command::publish;
5 4 $HiD::App::Command::publish::VERSION = '1.5';
6 4 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 extends 'HiD::App::Command';
8 4 with 'HiD::Role::PublishesDrafts';
9 4 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 4 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 4 ▶use autodie;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 4 ▶use warnings qw/ FATAL utf8 /;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 4 ▶use open qw/ :std :utf8 /;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 4 ▶use charnames qw/ :full /;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 4 ▶use feature qw/ unicode_strings /;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19  
20 4 has clean => (
21 is => 'ro' ,
22 isa => 'Bool' ,
23 cmd_aliases => 'C' ,
24 traits => [ 'Getopt' ] ,
25 );
26  
27  
28 4 has limit_posts => (
29 is => 'ro' ,
30 isa => 'Int' ,
31 cmd_aliases => 'l' ,
32 traits => [ 'Getopt' ] ,
33 );
34  
35 sub _run {
36 16 ▶ my( $self , $opts , $args ) = @_;
Subroutine _run: called CC=4 SCAR=16.1
37  
38 16 my $config = $self->config;
39 16 ▶ if ( $self->clean ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->clean) 0 16 16
40 0 $config->{clean_destination} = 1;
41 }
42  
43 16 ▶ if ( $self->limit_posts ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->limit_posts) 0 16 16
44 0 $config->{limit_posts} = $self->limit_posts;
45 }
46  
47 16 ▶ if ( $self->publish_drafts ){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->publish_drafts) 0 16 16
48 0 $config->{publish_drafts} = 1;
49 }
50  
51 16 $self->publish;
52 }
53  
54 4 __PACKAGE__->meta->make_immutable;
55 4 1;
56  
57 __END__
58  
59 =pod
60  
61 =encoding utf-8
62  
63 =head1 NAME
64  
65 HiD::App::Command::publish - publish site
66  
67 =head1 SYNOPSIS
68  
69 $ hid publish
70  
71 $ hid # 'publish' is the default command...
72  
73 =head1 DESCRIPTION
74  
75 Processes files according to the active configuration and writes output files
76 accordingly.
77  
78 =head1 ATTRIBUTES
79  
80 =head2 clean
81  
82 Remove any existing site directory prior to the publication run
83  
84 =head2 limit_posts
85  
86 Limit the number of blog posts that will be written out. If you have a large
87 number of blog posts that haven't changed, setting this can significantly
88 speed up the publication process.
89  
90 =head1 SEE ALSO
91  
92 See L<HiD::App::Command> for additional command line options supported by all
93 sub commands.
94  
95 =head1 VERSION
96  
97 version 1.5
98  
99 =head1 AUTHOR
100  
101 John SJ Anderson <genehack@genehack.org>
102  
103 =head1 COPYRIGHT AND LICENSE
104  
105 This software is copyright (c) 2014 by John SJ Anderson.
106  
107 This is free software; you can redistribute it and/or modify it under
108 the same terms as the Perl 5 programming language system itself.
109  
110 =cut
« HiD/VirtualPage.pm ↑ Summary HiD/App/Command/init.pm »