line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Start::Flavor; |
2
|
1
|
|
|
1
|
|
734
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use base 'Module::Start::Base'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
92
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
5
|
use Class::Field qw'field'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
48
|
|
8
|
1
|
|
|
1
|
|
5
|
use IO::All; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
9
|
1
|
|
|
1
|
|
71
|
use XXX; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
field 'config' => -init => '$self->new_config_object'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub install_files { |
14
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
15
|
0
|
|
|
|
|
|
my $class = ref($self); |
16
|
0
|
|
|
|
|
|
my $flavor = $self->flavor; |
17
|
0
|
|
|
|
|
|
my $base = $self->config->base_dir; |
18
|
0
|
|
|
|
|
|
my $file_map = $self->read_data_files($class); |
19
|
0
|
|
|
|
|
|
for my $file_name (sort keys %$file_map) { |
20
|
0
|
|
|
|
|
|
my $file_content = $file_map->{$file_name}; |
21
|
0
|
|
|
|
|
|
io("$base/templates/$flavor/$file_name") |
22
|
|
|
|
|
|
|
->assert->print($file_content); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub start_module { |
27
|
0
|
|
|
0
|
0
|
|
my ($self, $args) = @_; |
28
|
0
|
|
|
|
|
|
$self->config->initialize($args); |
29
|
0
|
|
|
|
|
|
my $dist_name = $self->config->module_dist_name; |
30
|
0
|
0
|
|
|
|
|
$self->exit("'$dist_name' already exits") |
31
|
|
|
|
|
|
|
if -e $dist_name; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my $templates_path = $self->config->templates_path; |
34
|
0
|
|
|
|
|
|
my @files = io($templates_path)->All_Files; |
35
|
0
|
|
|
|
|
|
print "Changing to directory $dist_name\n"; |
36
|
0
|
|
|
|
|
|
my $dist = io->dir($dist_name)->mkdir->chdir; |
37
|
0
|
|
|
|
|
|
my $manifest = ''; |
38
|
0
|
|
|
|
|
|
for my $file (@files) { |
39
|
0
|
|
|
|
|
|
my $name = './' . $file->abs2rel($templates_path); |
40
|
0
|
0
|
|
|
|
|
next if $name eq './__config__'; |
41
|
0
|
|
|
|
|
|
$name =~ s/\+\+(.*?)\+\+/$self->config->$1/ge; |
|
0
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
if ($name eq './MANIFEST') { |
43
|
0
|
|
|
|
|
|
$manifest = $file; |
44
|
0
|
|
|
|
|
|
io('MANIFEST')->touch; |
45
|
0
|
|
|
|
|
|
next; |
46
|
|
|
|
|
|
|
} |
47
|
0
|
|
|
|
|
|
$self->create_file($name, $file); |
48
|
|
|
|
|
|
|
} |
49
|
0
|
0
|
|
|
|
|
if ($manifest) { |
50
|
0
|
|
|
|
|
|
$self->create_file('./MANIFEST', $manifest); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub create_file { |
55
|
0
|
|
|
0
|
0
|
|
my ($self, $name, $file) = @_; |
56
|
0
|
|
|
|
|
|
my $template = $file->all; |
57
|
0
|
|
|
|
|
|
my $result = $self->render_template(\ $template, |
58
|
0
|
|
|
|
|
|
%{$self->config}, |
59
|
|
|
|
|
|
|
); |
60
|
0
|
|
|
|
|
|
print "Creating $name\n"; |
61
|
0
|
|
|
|
|
|
io->file($name)->assert->print($result); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub manifest_files { |
65
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
66
|
0
|
|
|
|
|
|
my @files = io('.')->All_Files; |
67
|
0
|
|
|
|
|
|
return join "", |
68
|
|
|
|
|
|
|
sort { |
69
|
0
|
|
|
|
|
|
lc($a) cmp lc($b) |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
map { |
72
|
0
|
|
|
|
|
|
$_->abs2rel . "\n" |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
@files; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |