| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
490
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
33
|
|
|
2
|
1
|
|
|
1
|
|
5
|
use warnings FATAL => 'all'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
32
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use utf8; |
|
|
1
|
|
|
|
|
24
|
|
|
|
1
|
|
|
|
|
29
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Amon2::Setup::Flavor::Large; |
|
6
|
1
|
|
|
1
|
|
44
|
use parent qw(Amon2::Setup::Flavor); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
9
|
|
|
7
|
1
|
|
|
1
|
|
58
|
use File::Path (); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
903
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '6.14'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub admin_script { |
|
12
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
13
|
0
|
|
|
|
|
|
my $admin_script = 'script/' . lc($self->{dist}) . '-admin-server'; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub web_script { |
|
17
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
18
|
0
|
|
|
|
|
|
my $web_script = 'script/' . lc($self->{dist}) . '-web-server'; |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub run { |
|
22
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
23
|
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
my $admin_script = $self->admin_script; |
|
25
|
0
|
|
|
|
|
|
my $web_script = $self->web_script; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# write code. |
|
28
|
0
|
|
|
|
|
|
for my $moniker (qw(web admin)) { |
|
29
|
|
|
|
|
|
|
# static files |
|
30
|
0
|
|
|
|
|
|
$self->write_assets("static/${moniker}"); |
|
31
|
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
$self->render_file( "tmpl/${moniker}/index.tx", "Basic/tmpl/index.tx" ); |
|
33
|
0
|
|
|
|
|
|
$self->render_file( "tmpl/${moniker}/include/layout.tx", "Basic/tmpl/include/layout.tx" ); |
|
34
|
0
|
|
|
|
|
|
$self->render_file( "tmpl/${moniker}/include/pager.tx", "Basic/tmpl/include/pager.tx" ); |
|
35
|
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
$self->write_file("static/${moniker}/img/.gitignore", ''); |
|
37
|
0
|
|
|
|
|
|
$self->write_file("static/${moniker}/robots.txt", ''); |
|
38
|
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
$self->render_file("static/${moniker}/js/main.js", "Basic/static/js/main.js"); |
|
40
|
0
|
|
|
|
|
|
$self->render_file("static/${moniker}/css/main.css", "Basic/static/css/main.css"); |
|
41
|
|
|
|
|
|
|
} |
|
42
|
0
|
|
|
|
|
|
$self->render_file('tmpl/admin/error.tx', 'Large/tmpl/admin/error.tx'); |
|
43
|
0
|
|
|
|
|
|
$self->render_file('tmpl/web/error.tx', 'Large/tmpl/web/error.tx'); |
|
44
|
0
|
|
|
|
|
|
$self->render_file('tmpl/admin/index.tx', 'Large/tmpl/admin/index.tx'); |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
$self->render_file('tmpl/admin/include/layout.tx', 'Large/tmpl/admin/include/layout.tx'); |
|
47
|
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
$self->render_file('static/admin/css/admin.css', 'Large/static/admin/css/admin.css', {color1 => '#117711', color2 => '#119911'}); |
|
49
|
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
$self->render_file('tmpl/admin/include/sidebar.tx', 'Large/tmpl/admin/include/sidebar.tx'); |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# building stuff |
|
53
|
0
|
|
|
|
|
|
$self->render_file( 'Build.PL', 'Minimum/Build.PL' ); |
|
54
|
0
|
|
|
|
|
|
$self->render_file( 'minil.toml', 'Minimum/minil.toml' ); |
|
55
|
0
|
|
|
|
|
|
$self->render_file( 'builder/MyBuilder.pm', 'Minimum/builder/MyBuilder.pm' ); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
$self->render_file('db/.gitignore', 'Basic/db/dot.gitignore'); |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# configuration files |
|
61
|
0
|
|
|
|
|
|
for my $env (qw(development production test)) { |
|
62
|
0
|
|
|
|
|
|
$self->render_file( "config/${env}.pl", 'Basic/config/__ENV__.pl', { env => $env } ); |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
$self->render_file( 'sql/mysql.sql', 'Large/sql/mysql.sql' ); |
|
66
|
0
|
|
|
|
|
|
$self->render_file( 'sql/sqlite.sql', 'Large/sql/sqlite.sql' ); |
|
67
|
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
$self->render_file( 't/00_compile.t', 'Large/t/00_compile.t' ); |
|
69
|
0
|
|
|
|
|
|
$self->render_file( 't/web/01_root.t', 'Minimum/t/01_root.t', { |
|
70
|
|
|
|
|
|
|
psgi_file => $web_script, |
|
71
|
|
|
|
|
|
|
}); |
|
72
|
0
|
|
|
|
|
|
$self->render_file( 't/02_mech.t', 'Minimum/t/02_mech.t', { |
|
73
|
|
|
|
|
|
|
psgi_file => $web_script, |
|
74
|
|
|
|
|
|
|
}); |
|
75
|
0
|
|
|
|
|
|
$self->render_file( 't/03_assets.t', 'Basic/t/03_assets.t', { |
|
76
|
|
|
|
|
|
|
psgi_file => $web_script, |
|
77
|
|
|
|
|
|
|
}); |
|
78
|
0
|
|
|
|
|
|
$self->render_file( 't/04_admin.t', 'Large/t/04_admin.t', { |
|
79
|
|
|
|
|
|
|
psgi_file => $admin_script, |
|
80
|
|
|
|
|
|
|
}); |
|
81
|
0
|
|
|
|
|
|
$self->render_file( 't/06_jshint.t', 'Basic/t/06_jshint.t' ); |
|
82
|
0
|
|
|
|
|
|
$self->render_file( 't/07_mech_links.t', 'Large/t/07_mech_links.t', { |
|
83
|
|
|
|
|
|
|
psgi_file => $web_script, |
|
84
|
|
|
|
|
|
|
}); |
|
85
|
0
|
|
|
|
|
|
$self->render_file( 't/Util.pm', 'Basic/t/Util.pm' ); |
|
86
|
0
|
|
|
|
|
|
$self->render_file( 'xt/01_pod.t', 'Minimum/xt/01_pod.t' ); |
|
87
|
0
|
|
|
|
|
|
$self->render_file( 'xt/02_perlcritic.t', 'Basic/xt/02_perlcritic.t' ); |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
$self->create_cpanfile( |
|
91
|
|
|
|
|
|
|
{ |
|
92
|
|
|
|
|
|
|
'Amon2::Util' => 0, |
|
93
|
|
|
|
|
|
|
'Amon2::Web' => 0, |
|
94
|
|
|
|
|
|
|
'Amon2::Web::Dispatcher::RouterBoom' => 0, |
|
95
|
|
|
|
|
|
|
'DBD::SQLite' => 0, |
|
96
|
|
|
|
|
|
|
'DBI' => 0, |
|
97
|
|
|
|
|
|
|
'File::ShareDir' => 0, |
|
98
|
|
|
|
|
|
|
'Getopt::Long' => 0, |
|
99
|
|
|
|
|
|
|
'HTTP::Session2::ClientStore2' => 0, |
|
100
|
|
|
|
|
|
|
'Crypt::CBC' => '0', |
|
101
|
|
|
|
|
|
|
'Crypt::Rijndael' => '0', |
|
102
|
|
|
|
|
|
|
'Module::Build' => 0, |
|
103
|
|
|
|
|
|
|
'Module::Find' => 0, # load controllers |
|
104
|
|
|
|
|
|
|
'Module::Functions' => 2, # Dispatcher |
|
105
|
|
|
|
|
|
|
'Plack::App::File' => 0, |
|
106
|
|
|
|
|
|
|
'Plack::Builder' => 0, |
|
107
|
|
|
|
|
|
|
'Plack::Loader' => 0, |
|
108
|
|
|
|
|
|
|
'Plack::Middleware::ReverseProxy' => 0, |
|
109
|
|
|
|
|
|
|
'Plack::Session::Store::DBI' => 0, |
|
110
|
|
|
|
|
|
|
'Router::Boom' => '0.06', |
|
111
|
|
|
|
|
|
|
'Teng' => 0, |
|
112
|
|
|
|
|
|
|
'Teng::Row' => 0, |
|
113
|
|
|
|
|
|
|
'Teng::Schema::Declare' => 0, |
|
114
|
|
|
|
|
|
|
'parent' => 0, |
|
115
|
|
|
|
|
|
|
} |
|
116
|
|
|
|
|
|
|
); |
|
117
|
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
$self->render_file('.gitignore', 'Basic/dot.gitignore'); |
|
119
|
0
|
|
|
|
|
|
$self->render_file('.proverc', 'Basic/dot.proverc'); |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
{ |
|
122
|
0
|
|
|
|
|
|
my %status = ( |
|
|
0
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
'503' => 'Service Unavailable', |
|
124
|
|
|
|
|
|
|
'502' => 'Bad Gateway', |
|
125
|
|
|
|
|
|
|
'500' => 'Internal Server Error', |
|
126
|
|
|
|
|
|
|
'504' => 'Gateway Timeout', |
|
127
|
|
|
|
|
|
|
'404' => 'Not Found' |
|
128
|
|
|
|
|
|
|
); |
|
129
|
0
|
|
|
|
|
|
while (my ($status, $status_message) = each %status) { |
|
130
|
0
|
|
|
|
|
|
$self->render_file( |
|
131
|
|
|
|
|
|
|
"static/$status.html", |
|
132
|
|
|
|
|
|
|
"Basic/static/__STATUS__.html", |
|
133
|
|
|
|
|
|
|
{ status => $status, status_message => $status_message } |
|
134
|
|
|
|
|
|
|
); |
|
135
|
|
|
|
|
|
|
} |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
|
|
138
|
0
|
|
|
|
|
|
$self->render_file( 'lib/<<PATH>>.pm', 'Basic/lib/__PATH__.pm' ); |
|
139
|
0
|
|
|
|
|
|
$self->render_file( 'lib/<<PATH>>/DB.pm', 'Basic/lib/__PATH__/DB.pm' ); |
|
140
|
0
|
|
|
|
|
|
$self->render_file( 'lib/<<PATH>>/DB/Schema.pm', 'Basic/lib/__PATH__/DB/Schema.pm' ); |
|
141
|
0
|
|
|
|
|
|
$self->render_file( 'lib/<<PATH>>/DB/Row.pm', 'Basic/lib/__PATH__/DB/Row.pm' ); |
|
142
|
|
|
|
|
|
|
|
|
143
|
0
|
|
|
|
|
|
$self->render_file("lib/<<PATH>>/Web/C/Account.pm", 'Large/lib/__PATH__/Web/C/Account.pm'); |
|
144
|
0
|
|
|
|
|
|
for my $moniker (qw(Web Admin)) { |
|
145
|
0
|
|
|
|
|
|
$self->render_file("lib/<<PATH>>/$moniker.pm", 'Large/lib/__PATH__/__MONIKER__.pm', {moniker => $moniker}); |
|
146
|
0
|
|
|
|
|
|
$self->render_file("lib/<<PATH>>/$moniker/Dispatcher.pm", 'Large/lib/__PATH__/__MONIKER__/Dispatcher.pm', {moniker => $moniker}); |
|
147
|
0
|
|
|
|
|
|
$self->render_file("lib/<<PATH>>/$moniker/C/Root.pm", 'Large/lib/__PATH__/__MONIKER__/C/Root.pm', {moniker => $moniker}); |
|
148
|
0
|
|
|
|
|
|
$self->render_file( "lib/<<PATH>>/${moniker}/ViewFunctions.pm", 'Large/lib/__PATH__/__MONIKER__/ViewFunctions.pm', { |
|
149
|
|
|
|
|
|
|
moniker => $moniker, |
|
150
|
|
|
|
|
|
|
lc_moniker => lc($moniker) |
|
151
|
|
|
|
|
|
|
}); |
|
152
|
0
|
|
|
|
|
|
$self->render_file( "lib/<<PATH>>/${moniker}/Plugin/Session.pm", 'Basic/lib/__PATH__/Web/Plugin/Session.pm', { |
|
153
|
|
|
|
|
|
|
package => "$self->{module}::${moniker}::Plugin::Session", |
|
154
|
|
|
|
|
|
|
}); |
|
155
|
0
|
|
|
|
|
|
$self->render_file( "lib/<<PATH>>/${moniker}/View.pm", 'Minimum/lib/__PATH__/Web/View.pm', { |
|
156
|
|
|
|
|
|
|
package => "$self->{module}::${moniker}::View", |
|
157
|
|
|
|
|
|
|
tmpl_path => "tmpl/" . lc($moniker), |
|
158
|
|
|
|
|
|
|
view_functions_package => "$self->{module}::${moniker}::ViewFunctions", |
|
159
|
|
|
|
|
|
|
}); |
|
160
|
|
|
|
|
|
|
} |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
|
163
|
0
|
|
|
|
|
|
$self->render_file( $admin_script, 'Large/script/admin.pl' ); |
|
164
|
0
|
|
|
|
|
|
$self->render_file( $web_script, 'Large/script/web.pl' ); |
|
165
|
|
|
|
|
|
|
} |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub show_banner { |
|
168
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
169
|
|
|
|
|
|
|
|
|
170
|
0
|
|
|
|
|
|
printf <<'...', $self->web_script, $self->admin_script; |
|
171
|
|
|
|
|
|
|
-------------------------------------------------------------- |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Setup script was done! You are ready to run the skelton. |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
You need to install the dependencies by: |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
> carton install |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Setup the SQLite3 database: |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
> sqlite3 db/development.db < sql/sqlite.sql |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
And then, run your application server: |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
> carton exec perl -Ilib %s |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
You can run the admin sites by following: |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
> carton exec perl -Ilib %s |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
-------------------------------------------------------------- |
|
192
|
|
|
|
|
|
|
... |
|
193
|
|
|
|
|
|
|
} |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
1; |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
__END__ |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=head1 NAME |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
Amon2::Setup::Flavor::Large - Flavor with admin pages |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
This is an Amon2 flavor based on Amon2::Setup::Flavor::Basic. |
|
206
|
|
|
|
|
|
|
|