| 1 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 1 | ▶ | use warnings FATAL => 'all'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | package Amon2::Setup::Flavor::Basic; | ||||||||||
| 6 | 1 | ▶ | use parent qw(Amon2::Setup::Flavor); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | our $VERSION = '6.18'; | |||||||||
| 9 | |||||||||||
| 10 | 0 | ▶ | sub run { | ||||||||
|
Subroutine
run: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 11 | 0 | my $self = shift; | |||||||||
| 12 | |||||||||||
| 13 | # write code. | ||||||||||
| 14 | 0 | $self->render_file( "tmpl/index.tx", "Basic/tmpl/index.tx" ); | |||||||||
| 15 | 0 | $self->render_file( "tmpl/include/layout.tx", "Basic/tmpl/include/layout.tx" ); | |||||||||
| 16 | 0 | $self->render_file( "tmpl/include/pager.tx", "Basic/tmpl/include/pager.tx" ); | |||||||||
| 17 | |||||||||||
| 18 | 0 | $self->render_file( 'lib/<<PATH>>.pm', 'Basic/lib/__PATH__.pm' ); | |||||||||
| 19 | 0 | $self->render_file( 'lib/<<PATH>>/Web.pm', 'Basic/lib/__PATH__/Web.pm' ); | |||||||||
| 20 | 0 | $self->render_file( 'lib/<<PATH>>/Web/Plugin/Session.pm','Basic/lib/__PATH__/Web/Plugin/Session.pm' ); | |||||||||
| 21 | 0 | $self->render_file( 'lib/<<PATH>>/Web/Dispatcher.pm', 'Basic/lib/__PATH__/Web/Dispatcher.pm' ); | |||||||||
| 22 | 0 | $self->render_file( 'lib/<<PATH>>/Web/View.pm', 'Minimum/lib/__PATH__/Web/View.pm' ); | |||||||||
| 23 | 0 | $self->render_file( 'lib/<<PATH>>/Web/ViewFunctions.pm', 'Minimum/lib/__PATH__/Web/ViewFunctions.pm' ); | |||||||||
| 24 | 0 | $self->render_file( 'lib/<<PATH>>/DB.pm', 'Basic/lib/__PATH__/DB.pm' ); | |||||||||
| 25 | 0 | $self->render_file( 'lib/<<PATH>>/DB/Schema.pm', 'Basic/lib/__PATH__/DB/Schema.pm' ); | |||||||||
| 26 | 0 | $self->render_file( 'lib/<<PATH>>/DB/Row.pm', 'Basic/lib/__PATH__/DB/Row.pm' ); | |||||||||
| 27 | |||||||||||
| 28 | 0 | $self->render_file( $self->psgi_file, 'Basic/script/server.pl' ); | |||||||||
| 29 | 0 | $self->render_file( 'Build.PL', 'Minimum/Build.PL' ); | |||||||||
| 30 | 0 | $self->render_file( 'minil.toml', 'Minimum/minil.toml' ); | |||||||||
| 31 | 0 | $self->render_file( 'builder/MyBuilder.pm', 'Minimum/builder/MyBuilder.pm' ); | |||||||||
| 32 | |||||||||||
| 33 | |||||||||||
| 34 | 0 | $self->create_cpanfile({ | |||||||||
| 35 | 'HTML::FillInForm::Lite' => '1.11', | ||||||||||
| 36 | 'Time::Piece' => '1.20', | ||||||||||
| 37 | 'Plack::Middleware::ReverseProxy' => '0.09', | ||||||||||
| 38 | 'JSON' => '2.50', | ||||||||||
| 39 | 'Teng' => '0.18', | ||||||||||
| 40 | 'DBD::SQLite' => '1.33', | ||||||||||
| 41 | 'Test::WWW::Mechanize::PSGI' => 0, | ||||||||||
| 42 | 'Router::Boom' => '0.06', | ||||||||||
| 43 | 'Plack::Middleware::Session' => 0, | ||||||||||
| 44 | 'Plack::Session::Store::File' => 0, | ||||||||||
| 45 | }); | ||||||||||
| 46 | |||||||||||
| 47 | # static files | ||||||||||
| 48 | 0 | $self->write_assets(); | |||||||||
| 49 | |||||||||||
| 50 | 0 | $self->write_file("static/img/.gitignore", ''); | |||||||||
| 51 | 0 | $self->write_file("static/robots.txt", ''); | |||||||||
| 52 | |||||||||||
| 53 | 0 | $self->render_file("static/js/main.js", "Basic/static/js/main.js"); | |||||||||
| 54 | 0 | $self->render_file("static/css/main.css", "Basic/static/css/main.css"); | |||||||||
| 55 | |||||||||||
| 56 | 0 | $self->render_file('db/.gitignore', 'Basic/db/dot.gitignore'); | |||||||||
| 57 | |||||||||||
| 58 | # configuration files | ||||||||||
| 59 | 0 | for my $env (qw(development production test)) { | |||||||||
| 60 | 0 | $self->render_file( "config/${env}.pl", 'Basic/config/__ENV__.pl', { env => $env } ); | |||||||||
| 61 | } | ||||||||||
| 62 | |||||||||||
| 63 | 0 | $self->render_file( 'sql/mysql.sql', 'Basic/sql/mysql.sql' ); | |||||||||
| 64 | 0 | $self->render_file( 'sql/sqlite.sql', 'Basic/sql/sqlite.sql' ); | |||||||||
| 65 | |||||||||||
| 66 | 0 | $self->render_file( 't/Util.pm', 'Basic/t/Util.pm' ); | |||||||||
| 67 | 0 | $self->render_file( 't/00_compile.t', 'Basic/t/00_compile.t' ); | |||||||||
| 68 | 0 | $self->render_file( 't/01_root.t', 'Minimum/t/01_root.t', { | |||||||||
| 69 | psgi_file => $self->psgi_file, | ||||||||||
| 70 | }); | ||||||||||
| 71 | 0 | $self->render_file( 't/02_mech.t', 'Minimum/t/02_mech.t', { | |||||||||
| 72 | psgi_file => $self->psgi_file, | ||||||||||
| 73 | }); | ||||||||||
| 74 | 0 | $self->render_file( 't/03_assets.t', 'Basic/t/03_assets.t', { | |||||||||
| 75 | psgi_file => $self->psgi_file, | ||||||||||
| 76 | }); | ||||||||||
| 77 | 0 | $self->render_file( 't/04_csrf.t', 'Basic/t/04_csrf.t', { | |||||||||
| 78 | psgi_file => $self->psgi_file, | ||||||||||
| 79 | }); | ||||||||||
| 80 | 0 | $self->render_file( 'xt/01_pod.t', 'Minimum/xt/01_pod.t' ); | |||||||||
| 81 | 0 | $self->render_file( 'xt/02_perlcritic.t', 'Basic/xt/02_perlcritic.t' ); | |||||||||
| 82 | |||||||||||
| 83 | 0 | $self->render_file('.gitignore', 'Basic/dot.gitignore'); | |||||||||
| 84 | 0 | $self->render_file('.proverc', 'Basic/dot.proverc'); | |||||||||
| 85 | |||||||||||
| 86 | { | ||||||||||
| 87 | 0 | my %status = ( | |||||||||
| 88 | '503' => 'Service Unavailable', | ||||||||||
| 89 | '502' => 'Bad Gateway', | ||||||||||
| 90 | '500' => 'Internal Server Error', | ||||||||||
| 91 | '504' => 'Gateway Timeout', | ||||||||||
| 92 | '404' => 'Not Found' | ||||||||||
| 93 | ); | ||||||||||
| 94 | 0 | ▶ | while (my ($status, $status_message) = each %status) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 95 | 0 | $self->render_file( | |||||||||
| 96 | "static/$status.html", | ||||||||||
| 97 | "Basic/static/__STATUS__.html", | ||||||||||
| 98 | { status => $status, status_message => $status_message } | ||||||||||
| 99 | ); | ||||||||||
| 100 | } | ||||||||||
| 101 | } | ||||||||||
| 102 | } | ||||||||||
| 103 | |||||||||||
| 104 | 0 | ▶ | sub psgi_file { | ||||||||
|
Subroutine
psgi_file: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 105 | 0 | my $self = shift; | |||||||||
| 106 | 0 | 'script/' . lc($self->{dist}) . '-server'; | |||||||||
| 107 | } | ||||||||||
| 108 | |||||||||||
| 109 | 0 | ▶ | sub show_banner { | ||||||||
|
Subroutine
show_banner: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 110 | 0 | my $self = shift; | |||||||||
| 111 | |||||||||||
| 112 | 0 | printf <<'...', $self->psgi_file; | |||||||||
| 113 | -------------------------------------------------------------- | ||||||||||
| 114 | |||||||||||
| 115 | Setup script was done! You are ready to run the skelton. | ||||||||||
| 116 | |||||||||||
| 117 | You need to install the dependencies by: | ||||||||||
| 118 | |||||||||||
| 119 | > carton install | ||||||||||
| 120 | |||||||||||
| 121 | And then, run your application server: | ||||||||||
| 122 | |||||||||||
| 123 | > carton exec perl -Ilib %s | ||||||||||
| 124 | |||||||||||
| 125 | -------------------------------------------------------------- | ||||||||||
| 126 | ... | ||||||||||
| 127 | } | ||||||||||
| 128 | |||||||||||
| 129 | 1 | 1; | |||||||||
| 130 | __END__ | ||||||||||