blob: 9057f9972a4829a7a7540f889889616222ffa765 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
# Test the new command.
hugo new site -h
stdout 'Create a new site in the provided directory'
hugo new site my-yaml-site --format yml
checkfile my-yaml-site/hugo.yml
hugo new site mysite -f
stdout 'Congratulations! Your new Hugo site was created in'
cd mysite
checkfile archetypes/default.md
checkfile hugo.toml
exists assets
exists content
exists data
exists i18n
exists layouts
exists static
exists themes
! exists resources
hugo new theme -h
stdout 'Create a new theme \(skeleton\) called \[name\] in ./themes'
hugo new theme mytheme
stdout 'Creating new theme'
! exists resources
cd themes
cd mytheme
checkfile archetypes/default.md
checkfile assets/css/main.css
checkfile assets/js/main.js
checkfile content/_index.md
checkfile content/posts/_index.md
checkfile content/posts/post-1.md
checkfile content/posts/post-2.md
checkfile content/posts/post-3/bryce-canyon.jpg
checkfile content/posts/post-3/index.md
checkfile layouts/_default/baseof.html
checkfile layouts/_default/home.html
checkfile layouts/_default/list.html
checkfile layouts/_default/single.html
checkfile layouts/partials/footer.html
checkfile layouts/partials/head.html
checkfile layouts/partials/head/css.html
checkfile layouts/partials/head/js.html
checkfile layouts/partials/header.html
checkfile layouts/partials/menu.html
checkfile layouts/partials/terms.html
checkfile static/favicon.ico
checkfile LICENSE
checkfile README.md
checkfile hugo.toml
checkfile theme.toml
exists data
exists i18n
cd $WORK/mysite
hugo new -h
stdout 'Create a new content file.'
hugo new posts/my-first-post.md
checkfile content/posts/my-first-post.md
cd ..
cd myexistingsite
hugo new post/foo.md -t mytheme
grep 'Dummy content' content/post/foo.md
cd $WORK
# In the three archetype format tests below, skip Windows testing to avoid
# newline differences when comparing to golden.
hugo new site json-site --format json
[!windows] cmp json-site/archetypes/default.md archetype-golden-json.md
hugo new site toml-site --format toml
[!windows] cmp toml-site/archetypes/default.md archetype-golden-toml.md
hugo new site yaml-site --format yaml
[!windows] cmp yaml-site/archetypes/default.md archetype-golden-yaml.md
-- myexistingsite/hugo.toml --
theme = "mytheme"
-- myexistingsite/content/p1.md --
---
title: "P1"
---
-- myexistingsite/themes/mytheme/hugo.toml --
-- myexistingsite/themes/mytheme/archetypes/post.md --
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---
Dummy content.
-- archetype-golden-json.md --
{
"date": "{{ .Date }}",
"draft": true,
"title": "{{ replace .File.ContentBaseName \"-\" \" \" | title }}"
}
-- archetype-golden-toml.md --
+++
date = '{{ .Date }}'
draft = true
title = '{{ replace .File.ContentBaseName "-" " " | title }}'
+++
-- archetype-golden-yaml.md --
---
date: '{{ .Date }}'
draft: true
title: '{{ replace .File.ContentBaseName "-" " " | title }}'
---
|