Merge pull request #154 from tiborvass/add-man-docs-scripts

Add scripts and targets for manpages and yamldocs
This commit is contained in:
Tibor Vass 2017-06-05 13:20:56 -07:00 committed by GitHub
commit ed5b663082
6 changed files with 44 additions and 5 deletions

4
.gitignore vendored
View File

@ -2,5 +2,9 @@
/build/ /build/
cli/winresources/rsrc_386.syso cli/winresources/rsrc_386.syso
cli/winresources/rsrc_amd64.syso cli/winresources/rsrc_amd64.syso
/man/man1/
/man/man5/
/man/man8/
/docs/yaml/gen/
coverage.txt coverage.txt
profile.out profile.out

View File

@ -6,17 +6,17 @@ all: binary
# remove build artifacts # remove build artifacts
.PHONY: clean .PHONY: clean
clean: clean:
rm -rf ./build/* cli/winresources/rsrc_* rm -rf ./build/* cli/winresources/rsrc_* ./man/man[1-9] docs/yaml/gen
# run go test # run go test
# the "-tags daemon" part is temporary # the "-tags daemon" part is temporary
.PHONY: test .PHONY: test
test: test:
./scripts/test/unit $(shell go list ./... | grep -v /vendor/) ./scripts/test/unit $(shell go list ./... | grep -v '/vendor/')
.PHONY: test-coverage .PHONY: test-coverage
test-coverage: test-coverage:
./scripts/test/unit-with-coverage ./scripts/test/unit-with-coverage $(shell go list ./... | grep -v '/vendor/')
.PHONY: lint .PHONY: lint
lint: lint:
@ -44,6 +44,16 @@ vendor: vendor.conf
vndr 2> /dev/null vndr 2> /dev/null
scripts/validate/check-git-diff vendor scripts/validate/check-git-diff vendor
## generate man pages from go source and markdown
.PHONY: manpages
manpages:
scripts/dos/generate-man.sh
## generate documentation YAML files consumed by docs repo
.PHONY: yamldocs
yamldocs:
scripts/docs/generate-yaml.sh
cli/compose/schema/bindata.go: cli/compose/schema/data/*.json cli/compose/schema/bindata.go: cli/compose/schema/data/*.json
go generate github.com/docker/cli/cli/compose/schema go generate github.com/docker/cli/cli/compose/schema

View File

@ -69,4 +69,14 @@ vendor: build_docker_image vendor.conf
docker run -ti --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make vendor docker run -ti --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make vendor
dynbinary: build_cross_image dynbinary: build_cross_image
docker run --rm $(ENVVARS) $(MOUNTS) $(CROSS_IMAGE_NAME) make dynbinary docker run -ti --rm $(ENVVARS) $(MOUNTS) $(CROSS_IMAGE_NAME) make dynbinary
## generate man pages from go source and markdown
.PHONY: manpages
manpages: build_docker_image
docker run -ti --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make manpages
## Generate documentation YAML files consumed by docs repo
.PHONY: yamldocs
yamldocs: build_docker_image
docker run -ti --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make yamldocs

View File

@ -7,6 +7,16 @@ set -eu
mkdir -p ./man/man1 mkdir -p ./man/man1
MD2MAN_REPO=github.com/cpuguy83/go-md2man
MD2MAN_COMMIT=$(grep -F "$MD2MAN_REPO" vendor.conf | cut -d' ' -f2)
(
go get -d "$MD2MAN_REPO"
cd "$GOPATH"/src/"$MD2MAN_REPO"
git checkout "$MD2MAN_COMMIT" &> /dev/null
go install "$MD2MAN_REPO"
)
# Generate man pages from cobra commands # Generate man pages from cobra commands
go build -o /tmp/gen-manpages ./man go build -o /tmp/gen-manpages ./man
/tmp/gen-manpages --root . --target ./man/man1 /tmp/gen-manpages --root . --target ./man/man1

5
scripts/docs/generate-yaml.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
go build -o build/yaml-docs-generator github.com/docker/cli/docs/yaml
mkdir docs/yaml/gen
build/yaml-docs-generator --root $(pwd) --target $(pwd)/docs/yaml/gen

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eu -o pipefail set -eu -o pipefail
for pkg in $(go list ./... | grep -v /vendor/); do for pkg in $@; do
./scripts/test/unit \ ./scripts/test/unit \
-cover \ -cover \
-coverprofile=profile.out \ -coverprofile=profile.out \