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