TaskPipe/Tool/Command_DeployFiles.pm untested

filter: Statementstmt 0.0% 0 / 32 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 40 CC 1 SCAR 6.9
CC
1
Cov
0%
execute
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package TaskPipe::Tool::Command_DeployFiles;
2  
3 use Moose;
4 use Carp;
5 use Try::Tiny;
6 use TaskPipe::FileInstaller;
7 use TaskPipe::Template_Config_Project;
8 use Module::Runtime 'require_module';
9  
10 extends 'TaskPipe::Tool::Command';
11  
12 has option_specs => (is => 'ro', isa => 'ArrayRef', default => sub{[{
13 module => __PACKAGE__,
14 items => [
15 'sample'
16 ]
17 }, {
18 module => 'TaskPipe::PathSettings::Global',
19 items => [
20 'project_root',
21 'project',
22 ],
23 is_config => 1
24 }, {
25 module => 'TaskPipe::PathSettings::Project',
26 items => [
27 'lib_dir',
28 'plan_dir',
29 'source_dir',
30 'log_dir'
31 ],
32 is_config => 1
33 }]});
34  
35  
36  
37 sub execute {
38 my ($self) = @_;
39  
40 my $module = 'TaskPipe::Sample_'.ucfirst($self->sample);
41 require_module( $module );
42  
43 my $sample = $module->new;
44  
45 $sample->deploy_files;
46 }
47  
48 =head1 NAME
49  
50 TaskPipe::Tool::Command_DeployFiles - command to deploy TaskPipe project files
51  
52 =head1 PURPOSE
53  
54 When creating a new project, run this command first to deploy project directory structure and file stubs.
55  
56 =head1 DESCRIPTION
57  
58 C<deploy files> is the first step in creating a new project. You need to supply the C<--project=myproject> parameter on the command line. C<deploy files> then creates a directory with the project name you specified (C</myproject> in our example), and the subdirectories such as C<lib>, C<logs> and C<conf>.
59  
60 A project config file is deployed into the project config dir (usually C</conf> unless you specified otherwise), which you need to edit before deploying cache tables (see the help for C<deploy tables>.) For example, if you installed TaskPipe in the sub-directory C</taskpipe> inside your home directory, and your project is called C<myproject> then the path to your project config should be
61  
62 ~/taskpipe/projects/myproject/conf/project.yml
63  
64 In particular, the database parameters (database name, host etc.) need to be filled in correctly before you will be able to issue any commands associated with the new project. (Look for parameter values that have a tilde C<~> in the new config file).
65  
66 =head1 OPTIONS
67  
68 =over
69  
70 =item sample
71  
72 The name of the sample to use to deploy files
73  
74 =back
75  
76 =cut
77  
78 has sample => (is => 'ro', isa => 'Str', default => 'stubs');
79  
80  
81 =head1 AUTHOR
82  
83 Tom Gracey <tomgracey@gmail.com>
84  
85 =head1 COPYRIGHT AND LICENSE
86  
87 Copyright (c) Tom Gracey 2018
88  
89 TaskPipe is free software, licensed under
90  
91 The GNU Public License Version 3
92  
93 =cut
94  
95  
96 __PACKAGE__->meta->make_immutable;
97 1;