| 1 | package <%= ${class} %>; | ||
| 2 | |||
| 3 | use Mojo::Base 'CallBackery'; | ||
| 4 | use CallBackery::Model::ConfigJsonSchema; | ||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | <%= ${class} %> - the application class | ||
| 9 | |||
| 10 | =head1 SYNOPSIS | ||
| 11 | |||
| 12 | use Mojolicious::Commands; | ||
| 13 | Mojolicious::Commands->start_app('<%= ${class} %>'); | ||
| 14 | |||
| 15 | =head1 DESCRIPTION | ||
| 16 | |||
| 17 | Configure the mojolicious engine to run our application logic | ||
| 18 | |||
| 19 | =cut | ||
| 20 | |||
| 21 | =head1 ATTRIBUTES | ||
| 22 | |||
| 23 | <%= ${class} %> has all the attributes of L<CallBackery> plus: | ||
| 24 | |||
| 25 | =cut | ||
| 26 | |||
| 27 | =head2 config | ||
| 28 | |||
| 29 | use our own plugin directory and our own configuration file: | ||
| 30 | |||
| 31 | =cut | ||
| 32 | |||
| 33 | has config => sub { | ||
| 34 | my $self = shift; | ||
| 35 | my $config = CallBackery::Model::ConfigJsonSchema->new( | ||
| 36 | app => $self, | ||
| 37 | file => $ENV{<%= ${class} %>_CONFIG} || $self->home->rel_file('etc/<%= ${filename} %>.yaml') | ||
| 38 | ); | ||
| 39 | unshift @{$config->pluginPath}, '<%= ${class} %>::GuiPlugin'; | ||
| 40 | return $config; | ||
| 41 | }; | ||
| 42 | |||
| 43 | |||
| 44 | has database => sub { | ||
| 45 | my $self = shift; | ||
| 46 | my $database = $self->SUPER::database(@_); | ||
| 47 | $database->sql->migrations | ||
| 48 | ->name('<%= ${class} %>BaseDB') | ||
| 49 | ->from_data(__PACKAGE__,'appdb.sql') | ||
| 50 | ->migrate; | ||
| 51 | return $database; | ||
| 52 | }; | ||
| 53 | |||
| 54 | 1; | ||
| 55 | |||
| 56 | =head1 COPYRIGHT | ||
| 57 | |||
| 58 | Copyright (c) <%= ${year} %> by <%= ${fullName} %>. All rights reserved. | ||
| 59 | |||
| 60 | =head1 AUTHOR | ||
| 61 | |||
| 62 | S<<%= ${fullName} %> E<lt><%= ${email} %>E<gt>> | ||
| 63 | |||
| 64 | =cut | ||
| 65 | |||
| 66 | __DATA__ |