blib/lib/JiftyX/Fixtures/Script/Init.pm untested

filter: Statementstmt 0.0% 0 / 44 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 63 CC 3 SCAR 14.2
CC
3
Cov
0%
run
12.0
options
2.0
before_run
2.0
CRAP 4.1
1 package JiftyX::Fixtures::Script::Init;
2 our $VERSION = '0.07';
3  
4 # ABSTRACT: init subcommand
5  
6 use warnings;
7 use strict;
8  
9 use Jifty;
10 use Jifty::Everything;
11  
12 use IO::File;
13 use File::Basename;
14 use File::Spec;
15 use YAML qw(Dump LoadFile);
16  
17 use base qw(
18 App::CLI::Command
19 );
20  
21 my $super = 'JiftyX::Fixtures::Script';
22  
23 our $help_msg = qq{
24 Usage:
25  
26 jiftyx-fixtures init [options]
27  
28 Options:
29  
30 -h, --help: show help
31  
32 };
33  
34 my $prototype = qq{
35 development:
36 dir: "etc/fixtures/development"
37 format: "yml"
38 greeking: "false"
39  
40 test:
41 dir: "etc/fixtures/test"
42 format: "yml"
43 greeking: "false"
44  
45 };
46  
47 sub options {
48 my ($self) = @_;
49 return (
50 $super->options,
51 );
52 }
53  
54 sub before_run {
55 my ($self) = @_;
56  
57 $super->before_run($self);
58  
59 return;
60 }
61  
62 sub run {
63 my ($self) = @_;
64 $self->before_run();
65
66 unless ($self->{config}->{fixtures}) {
67  
68 my $fixtures_config = IO::File->new;
69 if ($fixtures_config->open("> " . $self->{config}->{app_root} . "/etc/fixtures.yml")) {
70 print $fixtures_config $prototype;
71 }
72  
73 mkdir $self->{config}->{app_root} . "/etc/fixtures";
74 }
75 }
76  
77 1;
78  
79 __END__