version: include version in produced docs (#406)

Fixes #398

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2016-05-02 14:10:02 -04:00
parent 9630bf7acb
commit 4941dba4a8
3 changed files with 30 additions and 0 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
output
schema/validate
code-of-conduct.md
version.md

25
.tool/version-doc.go Normal file
View File

@ -0,0 +1,25 @@
// +build ignore
package main
import (
"fmt"
"html/template"
"os"
"github.com/opencontainers/runtime-spec/specs-go"
)
var markdownTemplateString = `
**Specification Version:** *{{.}}*
`
var markdownTemplate = template.Must(template.New("markdown").Parse(markdownTemplateString))
func main() {
if err := markdownTemplate.Execute(os.Stdout, specs.Version); err != nil {
fmt.Fprintln(os.Stderr, err)
}
}

View File

@ -2,6 +2,7 @@
DOCKER ?= $(shell which docker)
# These docs are in an order that determines how they show up in the PDF/HTML docs.
DOC_FILES := \
version.md \
README.md \
code-of-conduct.md \
principles.md \
@ -45,6 +46,9 @@ output/docs.html: $(DOC_FILES)
code-of-conduct.md:
curl -o $@ https://raw.githubusercontent.com/opencontainers/tob/d2f9d68c1332870e40693fe077d311e0742bc73d/code-of-conduct.md
version.md: ./specs-go/version.go
go run ./.tool/version-doc.go > $@
HOST_GOLANG_VERSION = $(shell go version | cut -d ' ' -f3 | cut -c 3-)
# this variable is used like a function. First arg is the minimum version, Second arg is the version to be checked.
ALLOWED_GO_VERSION = $(shell test '$(shell /bin/echo -e "$(1)\n$(2)" | sort -V | head -n1)' == '$(1)' && echo 'true')