-
Notifications
You must be signed in to change notification settings - Fork 177
Expand file tree
/
Copy pathmakefile
More file actions
57 lines (49 loc) · 2.56 KB
/
makefile
File metadata and controls
57 lines (49 loc) · 2.56 KB
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
50
51
52
53
54
55
56
57
.PHONY: all
all: unified-docs
.PHONY: unified-docs
unified-docs:
@echo "Starting up the unified-docs Docker container"
docker compose --profile unified-docs up
.PHONY: clean
clean:
@echo "Stopping and removing Docker containers and images..."
docker compose --profile unified-docs down --rmi local; \
docker rmi hashicorp/dev-portal --force
@echo "Removing public/content and public/assets directories..."
rm -rf public/content public/assets
.PHONY: help
help:
@echo "Available commands:"
@echo " make : Run the unified-docs Docker container"
@echo " make clean : Stop and remove project Docker containers and images"
@echo " make help : Display this help message"
# The following targets are for code generation for packer partials
# In order to run these targets, go must be installed and your GOPATH must be set up
# to point to the correct directory. For example, I ran the following to set up the correct path:
# export PATH=$PATH:/Users/user.name/go/bin
# Your go path may be different depending on your OS and go installation method
# After setting up your go path, you can run the following command to generate partials docs:
# make generate
.PHONY: install-gen-deps
install-gen-deps: ## Install dependencies for code generation
@GO111MODULE=on go install github.com/dmarkham/enumer@master
@go install github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc@latest
.PHONY: clone-packer
clone-packer: ## Clone the Packer repository for code generation
rm -rf .content-source-repos/packer
@echo "==> Cloning Packer repository..."
git clone --depth=1 --filter=blob:none https://github.com/hashicorp/packer .content-source-repos/packer
@echo "Packer repository cloned into .content-source-repos/packer"
.PHONY: generate
generate: install-gen-deps clone-packer ## Generate dynamically generated code
@echo "==> removing autogenerated code..."
@find .content-source-repos/packer/post-processor .content-source-repos/packer/helper .content-source-repos/packer/builder .content-source-repos/packer/provisioner -type f | xargs grep -l '^// Code generated' | xargs rm -f
cd .content-source-repos/packer; PROJECT_ROOT="$(shell pwd)" go generate $(shell cd .content-source-repos/packer; go list ./... | grep -v packer-plugin-sdk)
.PHONY: generate-check
generate-check: generate ## Check go code generation is on par
@echo "==> Checking that auto-generated code is not changed..."
@git diff --exit-code; if [ $$? -eq 1 ]; then \
echo "Found diffs in go generated code."; \
echo "You can use the command: \`make generate\` to reformat code."; \
exit 1; \
fi