commit
message
Flat structure pref
author
Ben Vogt <[email protected]>
date
2023-04-05 18:21:54
stats
17 file(s) changed,
23 insertions(+),
18 deletions(-)
files
Makefile
README.md
commit.go
examples/ghsr-simple.toml
example-config-ghsr-simple.toml
examples/go-git.toml
example-config-go-git.toml
file.go
files.go
gshr.toml
dev-config-gshr.toml
index.go
log.go
main.go
templates/commit.html
template.commit.html
templates/file.html
template.file.html
templates/files.html
template.files.html
templates/index.html
template.index.html
templates/log.html
template.log.html
templates/partials.html
template.partials.html
1diff --git a/Makefile b/Makefile
2index d54d5d8..ae3d344 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -13,6 +13,9 @@ target/output: target
6 clean:
7 rm -rf target/*
8
9+fmt:
10+ go fmt
11+
12 target/gshr.bin: Makefile target $(wildcard *.go)
13 go build -o target/gshr.bin $(wildcard *.go)
14
15@@ -20,16 +23,16 @@ build: Makefile target target/output target/gshr.bin
16 @# intentionally blank, proxy for prerequisite.
17
18 dev: Makefile target target/output target/gshr.bin
19- ./target/gshr.bin -c=gshr.toml -o=target/output \
20- cd target/output && python3 -m http.server 80
21+ ./target/gshr.bin -c=dev-config-gshr.toml -o=target/output && \
22+ cd target/output && \
23+ python3 -m http.server 80
24
25 dev-example-go-git: Makefile target target/output target/gshr.bin
26- ./target/gshr.bin -c=examples/go-git.toml -o=target/output \
27- cd target/output && python3 -m http.server 80
28-
29-dev-example-gshr: Makefile target target/output target/gshr.bin
30- ./target/gshr.bin -c=examples/gshr-simple.toml -o=target/output \
31- cd target/output && python3 -m http.server 80
32-
33-fmt:
34- go fmt
35\ No newline at end of file
36+ ./target/gshr.bin -c=example-config-gshr-simple.toml -o=target/output && \
37+ cd target/output && \
38+ python3 -m http.server 80
39+
40+dev-example-gshr-simple: Makefile target target/output target/gshr.bin
41+ ./target/gshr.bin -c=example-config-gshr-simple.toml -o=target/output && \
42+ cd target/output && \
43+ python3 -m http.server 80
44diff --git a/README.md b/README.md
45index de25ff8..8fbd3ec 100644
46--- a/README.md
47+++ b/README.md
48@@ -19,15 +19,15 @@ See for yourself.
49 ```bash
50 git clone https://github.com/vogtb/gshr
51 cd gshr
52-make dev-example-gshr
53+make dev-example-gshr-simple
54 ```
55
56 Which basically runs this.
57
58 ```bash
59-gshr -c=examples/gshr-simple.toml --output=/tmp/gshr-output
60-cd /tmp/gshr-output
61-python3 -m http.server 8000
62+./target/gshr.bin -c=example-config-gshr-simple.toml -o=target/output
63+cd target/output
64+python3 -m http.server 80
65 ```
66
67 See more examples in [tree/master/examples](tree/master/examples).
68diff --git a/commit.go b/commit.go
69index ad7281e..0cce59e 100644
70--- a/commit.go
71+++ b/commit.go
72@@ -35,7 +35,7 @@ func (c *CommitPage) RenderPage(t *template.Template) {
73 }
74
75 func RenderAllCommitPages(data RepoData, r *git.Repository) {
76- t, err := template.ParseFS(htmlTemplates, "templates/commit.html", "templates/partials.html")
77+ t, err := template.ParseFS(htmlTemplates, "template.commit.html", "template.partials.html")
78 checkErr(err)
79 ref, err := r.Head()
80 checkErr(err)
81diff --git a/gshr.toml b/dev-config-gshr.toml
82similarity index 100%
83rename from gshr.toml
84rename to dev-config-gshr.toml
85diff --git a/examples/ghsr-simple.toml b/example-config-ghsr-simple.toml
86similarity index 100%
87rename from examples/ghsr-simple.toml
88rename to example-config-ghsr-simple.toml
89diff --git a/examples/go-git.toml b/example-config-go-git.toml
90similarity index 100%
91rename from examples/go-git.toml
92rename to example-config-go-git.toml
93diff --git a/file.go b/file.go
94index 33676da..2c91f60 100644
95--- a/file.go
96+++ b/file.go
97@@ -43,7 +43,7 @@ func (f *FilePage) RenderPage(t *template.Template) {
98 }
99
100 func RenderSingleFilePages(data RepoData) {
101- t, err := template.ParseFS(htmlTemplates, "templates/file.html", "templates/partials.html")
102+ t, err := template.ParseFS(htmlTemplates, "template.file.html", "template.partials.html")
103 checkErr(err)
104 err = filepath.Walk(data.CloneDir(), func(filename string, info fs.FileInfo, err error) error {
105 if info.IsDir() && info.Name() == ".git" {
106diff --git a/files.go b/files.go
107index 28c2319..d8bb711 100644
108--- a/files.go
109+++ b/files.go
110@@ -31,7 +31,7 @@ func (f *FilesPage) RenderPage(t *template.Template) {
111 }
112
113 func RenderAllFilesPage(data RepoData) {
114- t, err := template.ParseFS(htmlTemplates, "templates/files.html", "templates/partials.html")
115+ t, err := template.ParseFS(htmlTemplates, "template.files.html", "template.partials.html")
116 checkErr(err)
117 files := make([]FileOverview, 0)
118 err = filepath.Walk(data.CloneDir(), func(filename string, info fs.FileInfo, err error) error {
119diff --git a/index.go b/index.go
120index 333b99c..27c9d18 100644
121--- a/index.go
122+++ b/index.go
123@@ -21,7 +21,7 @@ func (l *IndexPage) RenderPage(t *template.Template) {
124 }
125
126 func RenderIndexPage(repos []RepoData) {
127- t, err := template.ParseFS(htmlTemplates, "templates/index.html", "templates/partials.html")
128+ t, err := template.ParseFS(htmlTemplates, "template.index.html", "template.partials.html")
129 checkErr(err)
130 (&IndexPage{
131 BaseURL: config.BaseURL,
132diff --git a/log.go b/log.go
133index 3a80868..20dc28b 100644
134--- a/log.go
135+++ b/log.go
136@@ -35,7 +35,7 @@ func (l *LogPage) RenderPage(t *template.Template) {
137 }
138
139 func RenderLogPage(data RepoData, r *git.Repository) {
140- t, err := template.ParseFS(htmlTemplates, "templates/log.html", "templates/partials.html")
141+ t, err := template.ParseFS(htmlTemplates, "template.log.html", "template.partials.html")
142 checkErr(err)
143 commits := make([]LogPageCommit, 0)
144 ref, err := r.Head()
145diff --git a/main.go b/main.go
146index 4d2f8c3..0d8cbe0 100644
147--- a/main.go
148+++ b/main.go
149@@ -18,7 +18,7 @@ import (
150 "github.com/go-git/go-git/v5"
151 )
152
153-//go:embed templates/*
154+//go:embed template.*.html
155 var htmlTemplates embed.FS
156
157 //go:embed gshr.css
158diff --git a/templates/commit.html b/template.commit.html
159similarity index 100%
160rename from templates/commit.html
161rename to template.commit.html
162diff --git a/templates/file.html b/template.file.html
163similarity index 100%
164rename from templates/file.html
165rename to template.file.html
166diff --git a/templates/files.html b/template.files.html
167similarity index 100%
168rename from templates/files.html
169rename to template.files.html
170diff --git a/templates/index.html b/template.index.html
171similarity index 100%
172rename from templates/index.html
173rename to template.index.html
174diff --git a/templates/log.html b/template.log.html
175similarity index 100%
176rename from templates/log.html
177rename to template.log.html
178diff --git a/templates/partials.html b/template.partials.html
179similarity index 100%
180rename from templates/partials.html
181rename to template.partials.html