script/extjs-generator-dbic.pl untested

filter: Statementstmt 0.0% 0 / 34 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod n/a totaltotal 0.0% 0 / 51 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/bin/env perl
2  
3 # ABSTRACT: commandline script to use ExtJS-Generator-DBIC
4 use strict;
5 use warnings;
6 use ExtJS::Generator::DBIC::Model;
7 use Path::Class;
8  
9 {
10 package
11 ExtJS::Generator::DBIC::Options;
12 use strict;
13 use warnings;
14 use Moo;
15 use MooX::Options;
16  
17 option 'schemaname' => (
18 is => 'ro',
19 format => 's',
20 short => 's',
21 required => 1,
22 doc => 'DBIx::Class schema name',
23 );
24 option 'appname' => (
25 is => 'ro',
26 format => 's',
27 short => 'a',
28 required => 1,
29 doc => 'ExtJS application name',
30 );
31  
32 option 'model_namespace' => (
33 is => 'ro',
34 format => 's',
35 short => 'mn',
36 doc => 'ExtJS model namespace',
37 );
38  
39 option 'model_baseclass' => (
40 is => 'ro',
41 format => 's',
42 short => 'mb',
43 doc => 'ExtJS model baseclass',
44 );
45  
46 option 'model_args' => (
47 is => 'ro',
48 format => 'json',
49 short => 'ma',
50 doc => 'ExtJS model arguments',
51 );
52  
53 option 'directory' => (
54 is => 'ro',
55 format => 's',
56 short => 'd',
57 required => 1,
58 doc => 'output directory for the generated ExtJS classes',
59 );
60  
61 1;
62 }
63  
64 my $opt = ExtJS::Generator::DBIC::Options->new_with_options;
65  
66 my $generator = ExtJS::Generator::DBIC::Model->new(
67 schemaname => $opt->schemaname,
68 appname => $opt->appname,
69  
70 ( defined $opt->model_namespace )
71 ? ( model_namespace => $opt->model_namespace )
72 : (),
73  
74 ( defined $opt->model_baseclass )
75 ? ( model_baseclass => $opt->model_baseclass )
76 : (),
77  
78 ( defined $opt->model_args && ref $opt->model_args eq 'HASH' )
79 ? ( model_args => $opt->model_args )
80 : (),
81 );
82  
83 $generator->extjs_all_to_file($opt->directory);
84  
85 __END__