-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathMakefile
46 lines (35 loc) · 1.31 KB
/
Makefile
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
BINDATA_FILE := data/generated_bindata.go
# upstream data
EC2_INSTANCES_URL := "https://instances.vantage.sh/instances.json"
RDS_INSTANCES_URL := "https://instances.vantage.sh/rds/instances.json"
ELASTICACHE_INSTANCES_URL := "https://instances.vantage.sh/cache/instances.json"
OPENSEARCH_INSTANCES_URL := "https://instances.vantage.sh/opensearch/instances.json"
DEPS := "curl git jq"
all: update-data run-example
.PHONY: all
check_deps: ## Verify the system has all dependencies installed
@for DEP in $(shell echo "$(DEPS)"); do \
command -v "$$DEP" > /dev/null 2>&1 \
|| (echo "Error: dependency '$$DEP' is absent" ; exit 1); \
done
@echo "all dependencies satisifed: $(DEPS)"
.PHONY: check_deps
data/instances.json:
@mkdir -p data
@curl $(EC2_INSTANCES_URL) -o data/instances.json
@curl $(RDS_INSTANCES_URL) -o data/rds-instances.json
@curl $(ELASTICACHE_INSTANCES_URL) -o data/elasticache-instances.json
@curl $(OPENSEARCH_INSTANCES_URL) -o data/opensearch-instances.json
run-example:
@go get ./...
@go run examples/instances/instances.go | sort | tee generated_instances_data.txt | less -S
clean:
@rm -rf data
.PHONY: clean
update-data: clean data/instances.json
.PHONY: update-data
update-data-from-local-file: all
.PHONY: update-data-from-local-file
test:
@go test
.PHONY: test