Skip to content

Commit

Permalink
version: include version in produced docs (opencontainers#406)
Browse files Browse the repository at this point in the history
Fixes opencontainers#398

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
  • Loading branch information
vbatts committed May 2, 2016
1 parent 9630bf7 commit 4941dba
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
output
schema/validate
code-of-conduct.md
version.md
25 changes: 25 additions & 0 deletions .tool/version-doc.go
Original file line number Diff line number Diff line change
@@ -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)
}
}
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 4941dba

Please sign in to comment.