sync: add overrides

Still needed this to work locally, added a flag to the binary
(-plugindir) to make this possible. The default being set should make
this works for netlify as well.

Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
Miek Gieben
2020-03-24 15:45:46 +01:00
parent cb5cf84758
commit af24d7f4cd
2 changed files with 13 additions and 6 deletions
+4 -2
View File
@@ -1,3 +1,5 @@
PLUGINDIR:=.coredns/plugin
all:
hugo -d public/
cp _redirects public/
@@ -18,8 +20,8 @@ run:
# Sync CoreDNS' plugin README.md's to coredns.io. Also sync the release notes from the notes directory.
.PHONY: sync
sync:
@GO111MODULE=on go run bin/sync.go
@cp -vu .coredns/notes/coredns-* content/blog
@GO111MODULE=on go run bin/sync.go -plugindir $(PLUGINDIR)
@cp -vu $(PLUGINDIR)/../notes/coredns-* content/blog
# Scan all markdown files for Corefile snippets and check validity github.com/miekg/corecheck
.PHONY: test
+9 -4
View File
@@ -3,6 +3,7 @@ package main
import (
"bufio"
"bytes"
"flag"
"io/ioutil"
"log"
"os"
@@ -14,8 +15,7 @@ import (
)
const (
pluginDir = ".coredns/plugin/"
pageDir = "content/plugins/"
pageDir = "content/plugins/"
)
type page struct {
@@ -32,7 +32,12 @@ type meta struct {
Date string `toml:"date"`
}
var (
pluginDir = flag.String("plugindir", ".coredns/plugin", "directory where to find coredns")
)
func main() {
flag.Parse()
// Current pages
pages, err := getPages(pageDir)
if err != nil {
@@ -40,7 +45,7 @@ func main() {
}
// Incoming content
plugins, err := getContent(pluginDir)
plugins, err := getContent(*pluginDir)
if err != nil {
log.Fatalf("Failed getting all plugin contents: %s", err)
}
@@ -82,7 +87,7 @@ func main() {
if err != nil {
log.Fatalf("Error writing file: %s", err)
}
log.Printf("Wrote content changes %s to %s", path.Join(pluginDir, p, "README.md"), filePath)
log.Printf("Wrote content changes %s to %s", path.Join(*pluginDir, p, "README.md"), filePath)
}
}