line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Dapper::Init; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
App::Dapper::Init - Default project files to use when a "dapper init" command is used. |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
When using the dapper tool to initialize an empty directory with a new site, the files |
10
|
|
|
|
|
|
|
that are written to disk are contained in this file. For instance, the YAML project |
11
|
|
|
|
|
|
|
file, a layout template, and a starter post. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
2
|
|
13
|
use utf8; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
18
|
|
16
|
2
|
|
|
2
|
|
63
|
use open ':std', ':encoding(UTF-8)'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
18
|
|
17
|
2
|
|
|
2
|
|
1079
|
use 5.8.0; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
104
|
|
18
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
67
|
|
19
|
2
|
|
|
2
|
|
9
|
use warnings FATAL => 'all'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
96
|
|
20
|
|
|
|
|
|
|
|
21
|
2
|
|
|
2
|
|
1104
|
use App::Dapper::Utils; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
494
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $source_index_name = "index.md"; |
24
|
|
|
|
|
|
|
my $source_index_content = <<'SOURCE_INDEX_CONTENT'; |
25
|
|
|
|
|
|
|
--- |
26
|
|
|
|
|
|
|
layout: index |
27
|
|
|
|
|
|
|
title: Welcome |
28
|
|
|
|
|
|
|
--- |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Hello world. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
SOURCE_INDEX_CONTENT |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $templates_index_name = "index.html"; |
35
|
|
|
|
|
|
|
my $templates_index_content = <<'TEMPLATES_INDEX_CONTENT'; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
[% page.title %] |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
[% page.content %] |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
TEMPLATES_INDEX_CONTENT |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my $proj_file_template_content = <<'PROJ_FILE_TEMPLATE'; |
53
|
|
|
|
|
|
|
# Dapper configuration file |
54
|
|
|
|
|
|
|
--- |
55
|
|
|
|
|
|
|
name : My Site |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
PROJ_FILE_TEMPLATE |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 init |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Initialize a Dapper project. This method creates a config file, source and template directories. |
62
|
|
|
|
|
|
|
After calling this method, the project may be built. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub init { |
67
|
0
|
|
|
0
|
1
|
|
my ($source, $output, $layout, $config) = @_; |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
App::Dapper::Utils::create_file($config, $proj_file_template_content); |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
App::Dapper::Utils::create_dir($source); |
72
|
0
|
|
|
|
|
|
App::Dapper::Utils::create_file("$source/$source_index_name", $source_index_content); |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
App::Dapper::Utils::create_dir($layout); |
75
|
0
|
|
|
|
|
|
App::Dapper::Utils::create_file("$layout/$templates_index_name", $templates_index_content); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |