forked from crypto-org-chain/chain-main
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MakefileDoc
49 lines (39 loc) · 2.76 KB
/
MakefileDoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
###############################################################################
### Documentation ###
###############################################################################
include third_party/cosmos-sdk/contrib/devtools/Makefile
containerProtoVer=v0.7
containerProtoImage=tendermintdev/sdk-proto-gen:$(containerProtoVer)
containerProtoGen=cosmos-sdk-proto-gen-$(containerProtoVer)
containerProtoGenSwagger=cosmos-sdk-proto-gen-swagger-$(containerProtoVer)
containerProtoFmt=cosmos-sdk-proto-fmt-$(containerProtoVer)
BINDIR ?= ~/go/bin
all: update-swagger-docs
proto-swagger-gen:
@echo "Generating Protobuf Swagger"
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGenSwagger}$$"; then docker start -a $(containerProtoGenSwagger); else docker run --name $(containerProtoGenSwagger) -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) \
sh ./scripts/protoc-swagger-gen.sh; fi
@echo "Patch swagger documentations"
@sed -i".bak" "s/cosmosvaloper16xyempempp92x9hyzz9wrgf94r6j9h5f2w4n2l/crocncl16xyempempp92x9hyzz9wrgf94r6j9h5f2w4n2l/" app/docs/swagger-ui/swagger.yaml
@sed -i".bak" "s/cosmos16xyempempp92x9hyzz9wrgf94r6j9h5f06pxxv/cro16xyempempp92x9hyzz9wrgf94r6j9h5f06pxxv/" app/docs/swagger-ui/swagger.yaml
@sed -i".bak" "s/cosmosvalconspub1zcjduepq0vu2zgkgk49efa0nqwzndanq5m4c7pa3u4apz4g2r9gspqg6g9cs3k9cuf/crocnclconspub1zcjduepq0vu2zgkgk49efa0nqwzndanq5m4c7pa3u4apz4g2r9gspqg6g9cs3k9cuf/" app/docs/swagger-ui/swagger.yaml
@sed -i".bak" "s/example: Cosmos-Hub/example: crypto-org-chain-mainnet/" app/docs/swagger-ui/swagger.yaml
@rm app/docs/swagger-ui/swagger.yaml.bak
proto-gen:
@echo "Generating Protobuf files"
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGen}$$"; then docker start -a $(containerProtoGen); else docker run --name $(containerProtoGen) -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) \
sh ./scripts/protocgen.sh; fi
proto-format:
@echo "Formatting Protobuf files"
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoFmt}$$"; then docker start -a $(containerProtoFmt); else docker run --name $(containerProtoFmt) -v $(CURDIR):/workspace --workdir /workspace tendermintdev/docker-build-proto \
find ./ -not -path "./third_party/*" -name "*.proto" -exec clang-format -i {} \; ; fi
proto-all: proto-format proto-gen proto-swagger-gen
update-swagger-docs: statik
$(BINDIR)/statik -src=app/docs/swagger-ui -dest=app/docs -f -m
@if [ -n "$(git status --porcelain)" ]; then \
echo "\033[91mSwagger docs are out of sync!!!\033[0m";\
exit 1;\
else \
echo "\033[92mSwagger docs are in sync\033[0m";\
fi
.PHONY: proto-all proto-gen proto-swagger-gen proto-format proto-lint update-swagger-docs