Qgoda/Command/Watch.pm untested

filter: Statementstmt 0.0% 0 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 31 CC 1 SCAR 6.9
CC
1
Cov
0%
_getDefaults
2.0
_getOptionSpecs
2.0
_run
2.0
CRAP 2.0
1 #! /bin/false
2  
3 # Copyright (C) 2016-2018 Guido Flohr <guido.flohr@cantanea.com>,
4 # all rights reserved.
5  
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
10  
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15  
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18  
19 package Qgoda::Command::Watch;
20 $Qgoda::Command::Watch::VERSION = 'v0.9.2';
21 use strict;
22  
23 use Qgoda;
24 use Qgoda::CLI;
25  
26 use Locale::TextDomain qw(qgoda);
27  
28 use base 'Qgoda::Command';
29  
30 sub _getDefaults {}
31  
32 sub _getOptionSpecs {
33 drafts => 'D|drafts',
34 future => 'F|future',
35 dry_run => 'dry-run',
36 }
37  
38 sub _run {
39 my ($self, $args, $global_options, %options) = @_;
40  
41 Qgoda->new($global_options)->watch(%options);
42  
43 return $self;
44 }
45  
46 1;
47  
48 =head1 NAME
49  
50 qgoda watch - Build a qgoda site and watch for changes
51  
52 =head1 SYNOPSIS
53  
54 qgoda watch [<global options>] [--dry-run]
55  
56 Try 'qgoda --help' for a description of global options.
57  
58 =head1 DESCRIPTION
59  
60 Does exactly the same as `qgoda build` but does not terminate (hit CTRL-C
61 or close the terminal window instead).
62  
63 If the initial build was successful, the program monitors the file system
64 and starts a new build, whenever an input file was modified, deleted or
65 created. Subsequent build failures are not fatal.
66  
67 Whenever a build was finished, successful or not, the number of seconds elapsed
68 since the epoch are written into the file F<_timestamp>. This can be used
69 as a trigger to reload pages in the browser, restart a service, or similar.
70  
71 =head1 OPTIONS
72  
73 =over 4
74  
75 =item -D, --drafts
76  
77 Process draft documents (documents with the draft property set)
78  
79 =item -F, --future
80  
81 Process documents with a date (date property) in the future
82  
83 =item --dry-run
84  
85 Just print what would be done but do not write any files.
86  
87 =item -h, --help
88  
89 Show this help page and exit.
90  
91 =back
92  
93 =head1 SEE ALSO
94  
95 L<Qgoda::Command::Build>, qgoda(1)
96  
97 =head1 QGODA
98  
99 Part of L<Qgoda|http://www.qgoda.net/>.