| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
2
|
|
|
2
|
|
25310
|
use strict; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
103
|
|
|
2
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
134
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package App::PM::Website::Command::Build; |
|
5
|
|
|
|
|
|
|
{ |
|
6
|
|
|
|
|
|
|
$App::PM::Website::Command::Build::VERSION = '0.131611'; |
|
7
|
|
|
|
|
|
|
} |
|
8
|
2
|
|
|
2
|
|
10
|
use base 'App::PM::Website::Command'; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
1300
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
26689
|
use Template; |
|
|
2
|
|
|
|
|
57777
|
|
|
|
2
|
|
|
|
|
70
|
|
|
11
|
2
|
|
|
2
|
|
21
|
use Data::Dumper; |
|
|
2
|
|
|
|
|
28
|
|
|
|
2
|
|
|
|
|
808
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#ABSTRACT: render the website to local disk from the configuration files. |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub options |
|
16
|
|
|
|
|
|
|
{ |
|
17
|
0
|
|
|
0
|
0
|
|
my ($class, $app) = @_; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
return ( |
|
20
|
0
|
|
|
|
|
|
[ 'template-dir=s' => 'template dir path', |
|
21
|
|
|
|
|
|
|
{ default => "template" } ], |
|
22
|
|
|
|
|
|
|
[ 'build-dir=s' => 'build dir path', |
|
23
|
|
|
|
|
|
|
{ default => "./website" } ], |
|
24
|
|
|
|
|
|
|
[ 'date=s' => 'which month to build', |
|
25
|
|
|
|
|
|
|
{ default => scalar $class->today() } ], |
|
26
|
|
|
|
|
|
|
); |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub validate |
|
30
|
|
|
|
|
|
|
{ |
|
31
|
0
|
|
|
0
|
0
|
|
my ($self, $opt, $args ) = @_; |
|
32
|
0
|
|
|
|
|
|
$self->validate_or_create_dir($opt,'build_dir'); |
|
33
|
0
|
|
|
|
|
|
$self->validate_required_dir($opt, 'template_dir'); |
|
34
|
|
|
|
|
|
|
|
|
35
|
0
|
0
|
|
|
|
|
die $self->usage_error( "no arguments allowed") if @$args; |
|
36
|
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
return 1; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub execute |
|
41
|
|
|
|
|
|
|
{ |
|
42
|
0
|
|
|
0
|
1
|
|
my( $self, $opt, $args ) = @_; |
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
my ($meeting, @past_meetings) = $self->meetings(); |
|
45
|
0
|
|
0
|
|
|
|
my $loc = $meeting->{location} || |
|
46
|
|
|
|
|
|
|
$self->{config}{config}{location}{default}; |
|
47
|
0
|
|
|
|
|
|
my $tt_vars = { |
|
48
|
|
|
|
|
|
|
m => $meeting, |
|
49
|
|
|
|
|
|
|
meetings => \@past_meetings, |
|
50
|
|
|
|
|
|
|
presenter => $self->{config}->get_presenter, |
|
51
|
|
|
|
|
|
|
locations => $self->{config}->get_location, |
|
52
|
|
|
|
|
|
|
l => $self->{config}->get_location->{$loc}, |
|
53
|
|
|
|
|
|
|
}; |
|
54
|
0
|
|
|
|
|
|
my $execute_options = { |
|
55
|
|
|
|
|
|
|
template_file => "$opt->{template_dir}/index.tt", |
|
56
|
|
|
|
|
|
|
output_file => "$opt->{build_dir}/index.html", |
|
57
|
|
|
|
|
|
|
tt_vars => $tt_vars, |
|
58
|
|
|
|
|
|
|
}; |
|
59
|
0
|
|
|
|
|
|
$self->execute_template( $opt, $execute_options ); |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub execute_template |
|
63
|
|
|
|
|
|
|
{ |
|
64
|
0
|
|
|
0
|
0
|
|
my ($self, $opt, $tt_options) = @_; |
|
65
|
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
my $template_options = { |
|
67
|
|
|
|
|
|
|
INCLUDE_PATH => './', |
|
68
|
|
|
|
|
|
|
INTERPOLATE => 1, |
|
69
|
|
|
|
|
|
|
}; |
|
70
|
0
|
|
0
|
|
|
|
my $tt = Template->new( {} ) |
|
71
|
|
|
|
|
|
|
|| die "$Template::ERROR\n"; |
|
72
|
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
my @opts = ( |
|
74
|
|
|
|
|
|
|
@$tt_options{ qw( template_file tt_vars output_file ) }, |
|
75
|
|
|
|
|
|
|
( binmode => ':utf8' ) |
|
76
|
|
|
|
|
|
|
); |
|
77
|
|
|
|
|
|
|
|
|
78
|
2
|
|
|
2
|
|
11
|
use Data::Dumper; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
322
|
|
|
79
|
0
|
0
|
|
|
|
|
print Dumper { tt_process => \@opts } |
|
80
|
|
|
|
|
|
|
if $opt->{verbose}; |
|
81
|
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
my $success = 1; |
|
83
|
0
|
0
|
|
|
|
|
unless ($opt->{dry_run} ) |
|
84
|
|
|
|
|
|
|
{ |
|
85
|
0
|
0
|
|
|
|
|
$success = $tt->process( @opts ) |
|
86
|
|
|
|
|
|
|
or die $tt->error(), "\n"; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
return $success; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__END__ |