line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Command::Author::generate::leds_app; |
2
|
|
|
|
|
|
|
$Mojolicious::Command::Author::generate::leds_app::VERSION = '1.14'; |
3
|
1
|
|
|
1
|
|
162133
|
use Mojo::Base 'Mojolicious::Command'; |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
5
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
45872
|
use Mojo::Util qw(class_to_file class_to_path decamelize); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
57
|
|
6
|
1
|
|
|
1
|
|
5
|
use Mojo::File; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
306
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has description => 'Generate Mojo::Leds application directory structure'; |
9
|
|
|
|
|
|
|
has usage => sub { shift->extract_usage }; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub run { |
12
|
1
|
|
50
|
1
|
1
|
21772
|
my ( $self, $class ) = ( shift, shift || 'MyApp' ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Script |
15
|
1
|
|
|
|
|
5
|
my $name = class_to_file $class; |
16
|
1
|
|
|
|
|
60
|
$self->render_to_rel_file( 'mojo', "$name/script/$name", |
17
|
|
|
|
|
|
|
{ class => $class } ); |
18
|
1
|
|
|
|
|
2833
|
$self->chmod_rel_file( "$name/script/$name", 0744 ); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# Application class |
21
|
1
|
|
|
|
|
121
|
my $app = class_to_path $class; |
22
|
1
|
|
|
|
|
14
|
$self->render_to_rel_file( 'appclass', "$name/lib/$app", |
23
|
|
|
|
|
|
|
{ class => $class } ); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Config file (using the default moniker) |
26
|
1
|
|
|
|
|
2163
|
$self->render_to_rel_file( 'config', "$name/cfg/app.cfg" ); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Default Template |
29
|
1
|
|
|
|
|
2630
|
$self->render_to_rel_file( 'layout', "$name/www/layouts/default.html.ep" ); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Welcome Controller |
32
|
1
|
|
|
|
|
1942
|
my $controller = "welcome::index"; |
33
|
1
|
|
|
|
|
5
|
my $path = class_to_path $controller; |
34
|
1
|
|
|
|
|
17
|
$self->render_to_rel_file( 'controller', "$name/www/$path", |
35
|
|
|
|
|
|
|
{ class => $controller } ); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Welcome Template |
38
|
1
|
|
|
|
|
1759
|
my $dir = Mojo::File->new($path)->dirname; |
39
|
1
|
|
|
|
|
42
|
$self->render_to_rel_file( 'welcome', "$name/www/$dir/index.html.ep" ); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# Welcome CSS |
42
|
1
|
|
|
|
|
2193
|
$self->render_to_rel_file( 'welcomecss', "$name/www/$dir/index.css" ); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# Static file |
45
|
1
|
|
|
|
|
987
|
$self->render_to_rel_file( 'static', "$name/www/public/index.html" ); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# Test |
48
|
1
|
|
|
|
|
1462
|
$self->render_to_rel_file( 'test', "$name/t/basic.t", { class => $class } ); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# ABSTRACT: Mojo::Leds app generator command |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=pod |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 NAME |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Mojolicious::Command::Author::generate::leds_app - Mojo::Leds app generator command |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 VERSION |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
version 1.14 |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 SYNOPSIS |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Usage: APPLICATION generate leds_app [OPTIONS] [NAME] |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
mojo generate leds_app |
71
|
|
|
|
|
|
|
mojo generate leds_app TestApp |
72
|
|
|
|
|
|
|
mojo generate leds_app My::TestApp |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Options: |
75
|
|
|
|
|
|
|
-h, --help Show this summary of available options |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 DESCRIPTION |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
L generates application directory structures for fully functional |
80
|
|
|
|
|
|
|
L applications. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This is a core command, that means it is always enabled and its code a good example for learning to build new commands, |
83
|
|
|
|
|
|
|
you're welcome to fork it. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
See L for a list of commands that are available by default. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=encoding UTF-8 |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
L inherits all attributes from L and implements the |
92
|
|
|
|
|
|
|
following new ones. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 description |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
my $description = $app->description; |
97
|
|
|
|
|
|
|
$app = $app->description('Foo'); |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Short description of this command, used for the command list. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 usage |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
my $usage = $app->usage; |
104
|
|
|
|
|
|
|
$app = $app->usage('Foo'); |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Usage information for this command, used for the help screen. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 METHODS |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
L inherits all methods from L and implements the |
111
|
|
|
|
|
|
|
following new ones. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head2 run |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
$app->run(@ARGV); |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Run this command. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 SEE ALSO |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
L, L, L. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 AUTHOR |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Emiliano Bruni |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
This software is copyright (c) 2022 by Emiliano Bruni. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
132
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=cut |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
__DATA__ |