mirror of
https://github.com/coredns/coredns.io.git
synced 2024-04-21 12:32:00 +00:00
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:
@@ -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
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user