| 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::Build; | ||||||||||
| 20 | 2 | $Qgoda::Command::Build::VERSION = 'v0.9.2'; | |||||||||
| 21 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | |||||||||||
| 23 | 2 | ▶ | use Qgoda; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | 2 | ▶ | use Qgoda::CLI; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 25 | |||||||||||
| 26 | 2 | ▶ | use Locale::TextDomain qw(qgoda); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | |||||||||||
| 28 | 2 | ▶ | use base 'Qgoda::Command'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 29 | |||||||||||
| 30 | ▶ | sub _getDefaults {} | |||||||||
|
Subroutine
_getDefaults: called CC=1 SCAR=0.0
| |||||||||||
| 31 | |||||||||||
| 32 | sub _getOptionSpecs { | ||||||||||
| 33 | 2 | ▶ | drafts => 'D|drafts', | ||||||||
|
Subroutine
_getOptionSpecs: called CC=1 SCAR=0.0
| |||||||||||
| 34 | future => 'F|future', | ||||||||||
| 35 | dry_run => 'dry-run', | ||||||||||
| 36 | watch => 'w|watch' | ||||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | sub _run { | ||||||||||
| 40 | 2 | ▶ | my ($self, $args, $global_options, %options) = @_; | ||||||||
|
Subroutine
_run: called CC=2 SCAR=7.4
| |||||||||||
| 41 | |||||||||||
| 42 | 2 | ▶ | if ($options{watch}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | 0 | Qgoda::CLI->commandUsageError(build => __x(<<EOF, program => $0)); | |||||||||
| 44 | option '--watch' is not supported, use '{program} watch' instead!' | ||||||||||
| 45 | EOF | ||||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 2 | Qgoda->new($global_options)->build(%options); | |||||||||
| 49 | |||||||||||
| 50 | 2 | return $self; | |||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | 2 | 1; | |||||||||
| 54 | |||||||||||
| 55 | =head1 NAME | ||||||||||
| 56 | |||||||||||
| 57 | qgoda build - Build a qgoda site | ||||||||||
| 58 | |||||||||||
| 59 | =head1 SYNOPSIS | ||||||||||
| 60 | |||||||||||
| 61 | qgoda build [<global options>] [--dry-run] | ||||||||||
| 62 | |||||||||||
| 63 | Try 'qgoda --help' for a description of global options. | ||||||||||
| 64 | |||||||||||
| 65 | =head1 DESCRIPTION | ||||||||||
| 66 | |||||||||||
| 67 | Builds a Qgoda powered site. In brief it does the following: | ||||||||||
| 68 | |||||||||||
| 69 | It reads its configuration from the file F<_config.yaml> in the current | ||||||||||
| 70 | working directory. | ||||||||||
| 71 | |||||||||||
| 72 | It collects all files in the current directory but ignores all files and | ||||||||||
| 73 | directories with names starting with an underscore ('_'). | ||||||||||
| 74 | |||||||||||
| 75 | If a file contains front matter, that front matter is taken as meta | ||||||||||
| 76 | information about that file. Front-matter is in L<YAML|http://yaml.org> | ||||||||||
| 77 | format: | ||||||||||
| 78 | |||||||||||
| 79 | --- | ||||||||||
| 80 | title: My first blog post | ||||||||||
| 81 | type: post | ||||||||||
| 82 | --- | ||||||||||
| 83 | Text with *markup* or [% TemplateToolkit %] code follows. | ||||||||||
| 84 | |||||||||||
| 85 | If the file does not contain front matter, default values are applied | ||||||||||
| 86 | and no processing takes place. | ||||||||||
| 87 | |||||||||||
| 88 | The resulting output is then copied to the output directory F<_site>. | ||||||||||
| 89 | |||||||||||
| 90 | After the build was finished, the number of seconds elapsed since the epoch | ||||||||||
| 91 | is written into the file F<_timestamp>. | ||||||||||
| 92 | |||||||||||
| 93 | If you want to continuously recreate the site, whenever an input file | ||||||||||
| 94 | was modified, created or deleted, try the command F<qgoda watch> instead! | ||||||||||
| 95 | |||||||||||
| 96 | See L<http://www.qgoda.net/> for detailed information! | ||||||||||
| 97 | |||||||||||
| 98 | =head1 OPTIONS | ||||||||||
| 99 | |||||||||||
| 100 | =over 4 | ||||||||||
| 101 | |||||||||||
| 102 | =item -D, --drafts | ||||||||||
| 103 | |||||||||||
| 104 | Process draft documents (documents with the draft property set) | ||||||||||
| 105 | |||||||||||
| 106 | =item -F, --future | ||||||||||
| 107 | |||||||||||
| 108 | Process documents with a date (date property) in the future | ||||||||||
| 109 | |||||||||||
| 110 | =item --dry-run | ||||||||||
| 111 | |||||||||||
| 112 | Just print what would be done but do not write any files. | ||||||||||
| 113 | |||||||||||
| 114 | =item -h, --help | ||||||||||
| 115 | |||||||||||
| 116 | Show this help page and exit. | ||||||||||
| 117 | |||||||||||
| 118 | =back | ||||||||||
| 119 | |||||||||||
| 120 | =head1 SEE ALSO | ||||||||||
| 121 | |||||||||||
| 122 | qgoda(1), L<Qgoda::Command::Watch>, | ||||||||||
| 123 | L<Markdown|https://daringfireball.net/projects/markdown/syntax>, | ||||||||||
| 124 | L<Template Toolkit|http://www.template-toolkit.org/>, L<YAML|http://yaml.org/> | ||||||||||
| 125 | |||||||||||
| 126 | =head1 QGODA | ||||||||||
| 127 | |||||||||||
| 128 | Part of L<Qgoda|http://www.qgoda.net/>. | ||||||||||
| 129 | |||||||||||
| 130 | =cut | ||||||||||