Qgoda/Command/Init.pm untested

filter: Statementstmt 0.0% 0 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 24 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::Init;
20 $Qgoda::Command::Init::VERSION = 'v0.9.2';
21 use strict;
22  
23 use Qgoda;
24  
25 use base 'Qgoda::Command';
26  
27 sub _getDefaults { npm => 'npm', skip => [] }
28  
29 sub _getOptionSpecs {
30 force => 'f|force+',
31 npm => 'n|npm=s',
32 skip => 's|skip=s@'
33 }
34  
35 sub _run {
36 my ($self, $args, $global_options, %options) = @_;
37  
38 Qgoda->new($global_options)->init($args, %options);
39  
40 return $self;
41 }
42  
43 1;
44  
45 =head1 NAME
46  
47 qgoda init - Initialize a Qgoda site with a theme
48  
49 =head1 SYNOPSIS
50  
51 qgoda init [<global options>] [-f|--force] [-n|--npm=PROGRAM]
52 [-s|--skip=TASK] [<repository>]
53  
54 Try 'qgoda --help' for a description of global options.
55  
56 =head1 DESCRIPTION
57  
58 Initializes or updates a new Qgoda site with a pre-defined theme.
59  
60 If B<repository> is omitted, L<http://github.com/gflohr/qgoda-default> is
61 used.
62  
63 If the current directory already contains a qgoda site, only new files
64 are copied into it, unless the option '--force' was given.
65  
66 The same applies to the update of the configuration file F<_config.yaml>.
67 If it exists, and the option '--force' was given, the current configuration
68 is merged with the default remote configuration from the theme.
69  
70 The command neither implies "qgoda build" nor "qgoda watch". If the theme
71 configures an external helper program such as "yarn", "npm", "make" and so on,
72 a warning is printed.
73  
74 =head1 FORMAT OF REPOSITORY STRINGS
75  
76 You can specify the repository in one of the following format:
77  
78 =over 4
79  
80 =item git://github.com/gflohr/qgoda-site
81  
82 =item git+ssh://example.com/foo/bar
83  
84 =item git+http://github.com/gflohr/qgoda-site
85  
86 =item git+https://github.com/gflohr/qgoda-site
87  
88 =item git+file:///var/git/qgoda/fancy.git
89  
90 All of these strings are passed as is to "git clone".
91  
92 =item gflohr/qgoda-default
93  
94 A shortcut for "git://github.com/gflohr/qgoda-default".
95  
96 =item http://git.example.com/foo/bar.tar.gz
97  
98 If a URI points to a archive file format, the archive is downloaded and
99 extracted to the current directory.
100  
101 =item file:///path/to/directory
102  
103 The contents of the directory is copied.
104  
105 =back
106  
107 =head1 OPTIONS
108  
109 =over 4
110  
111 =item -f, --force
112  
113 Update (and overwrite) files and merge configurations. You can give
114 the option twice in order to also overwrite files which are considered
115 "precious" by the theme author. Most themes will only consider markdown
116 documents as precious.
117  
118 =item -n, --npm=PROGRAM
119  
120 Use B<PROGRAM> instead of F<npm> for initializing Node.JS dependencies.
121  
122 You currently can B<not> use yarn instead of npm!
123  
124 =item -s, --skip=TASK
125  
126 Skip task B<TASK>. Current tasks are:
127  
128 =over 8
129  
130 =item copy
131  
132 Copy files from repository.
133  
134 =item config
135  
136 Update F<_config.yaml>. Note that the configuration file is only updated,
137 when the option "--force" was specified on the command-line.
138  
139 =item node
140  
141 Do not update the project with the Node Package Manager NPM.
142  
143 =back
144  
145 You can specify the option multiple times if you want to skip multiple tasks.
146  
147 =item -h, --help
148  
149 Show this help page and exit.
150  
151 =back
152  
153 =head1 SEE ALSO
154  
155 qgoda(1), git(1)
156  
157 =head1 QGODA
158  
159 Part of L<Qgoda|http://www.qgoda.net/>.