Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #24 from tiborvass/man-yaml-scripts
Browse files Browse the repository at this point in the history
Add scripts and targets for manpages and yamldocs
  • Loading branch information
andrewhsu authored Jun 5, 2017
2 parents 8ce2c28 + f148100 commit c6dd1af
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 2 deletions.
4 changes: 4 additions & 0 deletions components/cli/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
/build/
cli/winresources/rsrc_386.syso
cli/winresources/rsrc_amd64.syso
/man/man1/
/man/man5/
/man/man8/
/docs/yaml/gen/
14 changes: 12 additions & 2 deletions components/cli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ all: binary
# remove build artifacts
.PHONY: clean
clean:
@rm -rf ./build/* cli/winresources/rsrc_*
@rm -rf ./build/* cli/winresources/rsrc_* ./man/man[1-9] docs/yaml/gen

# run go test
# the "-tags daemon" part is temporary
.PHONY: test
test:
@go test -tags daemon -v $(shell go list ./... | grep -v /vendor/)
@go test -tags daemon -v $(shell go list ./... | grep -v '/vendor/')

.PHONY: lint
lint:
Expand Down Expand Up @@ -42,6 +42,16 @@ vendor: vendor.conf
@vndr 2> /dev/null
@scripts/validate/check-git-diff vendor

## generate man pages from go source and markdown
.PHONY: manpages
manpages:
@scripts/docs/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
go generate github.com/docker/cli/cli/compose/schema

Expand Down
10 changes: 10 additions & 0 deletions components/cli/docker.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,15 @@ lint: build_linter_image
vendor: build_docker_image vendor.conf
@docker run -ti --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make vendor

## 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

dynbinary: build_cross_image
docker run --rm $(ENVVARS) $(MOUNTS) $(CROSS_IMAGE_NAME) make dynbinary
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ set -eu

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
go build -o /tmp/gen-manpages ./man
/tmp/gen-manpages --root . --target ./man/man1
Expand Down
5 changes: 5 additions & 0 deletions components/cli/scripts/docs/generate-yaml.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c6dd1af

Please sign in to comment.