aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgutmet <me.git@gutmet.org>2019-07-27 22:42:50 +0200
committergutmet <me.git@gutmet.org>2019-07-27 22:42:50 +0200
commit27cc696d88ad5f12d67064916c9be0ece9f45aa0 (patch)
tree2a8b8d8b7309197343cd56876d063288392b8a87
parent561692a8bacafd66db356a309e76ac73304d1419 (diff)
downloadwombat-27cc696d88ad5f12d67064916c9be0ece9f45aa0.tar.gz
use hardlink instead of full copy for files other than Markdown or HTML
-rw-r--r--generate/generate.go4
-rw-r--r--go.mod2
-rw-r--r--site/site.go1
-rw-r--r--splitter/splitter.go1
4 files changed, 5 insertions, 3 deletions
diff --git a/generate/generate.go b/generate/generate.go
index b27a15b..05a13d3 100644
--- a/generate/generate.go
+++ b/generate/generate.go
@@ -27,7 +27,7 @@ func clean() {
}
func stage1() {
- goutil.Copy("stage0", "stage1")
+ goutil.CopyDirsLinkFiles("stage0", "stage1")
mdfiles := goutil.RecListFilesExt("stage1", ".md")
htmlfrags := goutil.RecListFilesExt("stage1", ".html")
splitter.SplitAll(append(mdfiles, htmlfrags...))
@@ -43,7 +43,7 @@ func blogs() []string {
}
func stage2() {
- goutil.Copy("stage1", "stage2")
+ goutil.CopyDirsLinkFiles("stage1", "stage2")
site.Generate()
for _, blogdir := range blogs() {
blog.Generate(blogdir)
diff --git a/go.mod b/go.mod
index 87cf075..64e48f9 100644
--- a/go.mod
+++ b/go.mod
@@ -2,7 +2,7 @@ module git.gutmet.org/wombat.git
require (
git.gutmet.org/finstr.git v0.0.0-20190103161247-f1cd2d363522
- git.gutmet.org/goutil.git v0.0.0-20190219232751-e251b8616e36
+ git.gutmet.org/goutil.git v0.0.0-20190727202444-1a369915ff2f
git.gutmet.org/simpleserver.git v0.0.0-20181209151100-b298451c1f40
github.com/russross/blackfriday/v2 v2.0.1
github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95 // indirect
diff --git a/site/site.go b/site/site.go
index eba787f..2d895b9 100644
--- a/site/site.go
+++ b/site/site.go
@@ -120,6 +120,7 @@ func completePage(path string, t *template.Template, style string) {
fmt.Println(err)
}
destination := strings.Replace(path, "stage1", "stage2", 1)
+ os.Remove(destination) // remove hardlink before writing
goutil.WriteFile(destination, buf.String())
}
diff --git a/splitter/splitter.go b/splitter/splitter.go
index 21d7c3d..f9eeddc 100644
--- a/splitter/splitter.go
+++ b/splitter/splitter.go
@@ -60,6 +60,7 @@ func split(filename string) {
}
if len(strings.TrimSpace(metadata)) > 0 {
writeMetadata(filename, metadata)
+ os.Remove(filename) // remove hardlink before writing
goutil.WriteFile(filename, data)
}
}