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