line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Contenticious::Generator; |
2
|
3
|
|
|
3
|
|
222630
|
use Mojo::Base 'Mojolicious::Command'; |
|
3
|
|
|
|
|
13146
|
|
|
3
|
|
|
|
|
14
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# store everything in files |
5
|
|
|
|
|
|
|
sub init { |
6
|
1
|
|
|
1
|
1
|
1333
|
my $self = shift; |
7
|
1
|
|
|
|
|
2
|
$self->generate_config_file; |
8
|
1
|
|
|
|
|
1875
|
$self->generate_web_app; |
9
|
1
|
|
|
|
|
56
|
$self->generate_example_pages; |
10
|
1
|
|
|
|
|
5091
|
$self->generate_public_directory; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub generate_config_file { |
14
|
1
|
|
|
1
|
1
|
8
|
shift->render_to_rel_file(config => 'config'); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub generate_web_app { |
18
|
2
|
|
|
2
|
1
|
985
|
my $self = shift; |
19
|
2
|
|
|
|
|
13
|
$self->render_to_rel_file('webapp.pl' => 'webapp.pl'); |
20
|
2
|
|
|
|
|
3885
|
$self->chmod_rel_file('webapp.pl' => 0755); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub generate_example_pages { |
24
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
25
|
1
|
|
|
|
|
3
|
my @pages = qw(index.md 01_Perldoc.md 02_About.md); |
26
|
1
|
|
|
|
|
6
|
$self->render_to_rel_file(("pages/$_") x 2) for @pages; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub generate_public_directory { |
30
|
3
|
|
|
3
|
1
|
718
|
my $self = shift; |
31
|
3
|
|
|
|
|
7
|
my @public = qw(styles.css); |
32
|
3
|
|
|
|
|
21
|
$self->render_to_rel_file(("public/$_") x 2) for @public; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__DATA__ |