@@ -7,16 +7,12 @@ MAKE_DIR := $(abspath $(shell pwd))
77
88# Installs dependencies using poetry.
99install-python :
10- poetry install
10+ poetry install --no-root
1111
1212# Installs dependencies using npm.
1313install-node :
1414 npm install --legacy-peer-deps
1515
16- # Configures Git Hooks, which are scripts that run given a specified event.
17- .git/hooks/pre-commit :
18- cp scripts/pre-commit .git/hooks/pre-commit
19-
2016# Condensed Target to run all targets above.
2117install : install-node install-python .git/hooks/pre-commit
2218
@@ -33,11 +29,12 @@ format: ## Format and fix code
3329 poetry run ruff check . --fix-only
3430
3531# Creates the fully expanded OAS spec in json
36- publish : clean
32+ generate-sandbox-spec : clean
3733 mkdir -p build
3834 mkdir -p sandbox/specification
3935 npm run publish 2> /dev/null
40- cp build/eligibility-signposting-api.json sandbox/specification/eligibility-signposting-api.json
36+ cp build/specification/sandbox/eligibility-signposting-api.json sandbox/specification/eligibility-signposting-api.json
37+
4138# Files to loop over in release
4239_dist_include ="pytest.ini poetry.lock poetry.toml pyproject.toml Makefile build/. tests"
4340
@@ -66,6 +63,26 @@ get-spec: # Get the most recent specification live in proxygen
6663 $(MAKE ) setup-proxygen-credentials
6764 proxygen spec get
6865
66+ get-spec-uat : # Get the most recent specification live in proxygen
67+ $(MAKE ) setup-proxygen-credentials
68+ proxygen spec get --uat
69+
70+ publish-spec : # Publish the specification to proxygen
71+ $(MAKE ) setup-proxygen-credentials
72+ proxygen spec publish --specification-file build/prod/eligibility-signposting-api.yaml
73+
74+ publish-spec-uat : # Publish the specification to proxygen
75+ $(MAKE ) setup-proxygen-credentials
76+ proxygen spec publish --specification-file build/preprod/eligibility-signposting-api.yaml --uat
77+
78+ delete-spec : # Delete the specification from proxygen
79+ $(MAKE ) setup-proxygen-credentials
80+ proxygen spec delete
81+
82+ delete-spec-uat : # Delete the specification from proxygen
83+ $(MAKE ) setup-proxygen-credentials
84+ proxygen spec delete --uat
85+
6986# Specification
7087
7188guard-% :
@@ -107,9 +124,12 @@ endif
107124
108125construct-spec : guard-APIM_ENV
109126 @ $(MAKE ) update-spec-template APIM_ENV=$$ APIM_ENV
110- mkdir -p build/specification && \
127+ mkdir -p build/specification/ $( APIM_ENV ) && \
111128 npx redocly bundle specification/eligibility-signposting-api.yaml --remove-unused-components --keep-url-references --ext yaml \
112- > build/specification/eligibility-signposting-api.yaml
129+ > build/specification/$(APIM_ENV ) /eligibility-signposting-api.yaml
130+ ifeq ($(APIM_ENV ) ,sandbox)
131+ yq 'del(.components.securitySchemes)' build/specification/sandbox/eligibility-signposting-api.yaml > build/specification/sandbox/eligibility-signposting-api.yaml.tmp && mv build/specification/sandbox/eligibility-signposting-api.yaml.tmp build/specification/sandbox/eligibility-signposting-api.yaml
132+ endif
113133
114134SPEC_DIR := $(CURDIR ) /specification
115135POSTMAN_DIR := $(SPEC_DIR ) /postman
@@ -118,8 +138,9 @@ convert-postman: # Create Postman collection from OAS spec
118138 mkdir -p $(POSTMAN_DIR )
119139 cp $(SPEC_DIR ) /eligibility-signposting-api.yaml $(POSTMAN_DIR ) /
120140 docker build -t portman-converter -f $(POSTMAN_DIR ) /Dockerfile $(SPEC_DIR )
121- docker run --rm -v $(SPEC_DIR ) :/app portman-converter \
141+ docker run --rm -u $( shell id -u) : $( shell id -g) - v $(SPEC_DIR ) :/app portman-converter \
122142 portman -l /app/eligibility-signposting-api.yaml -o /app/postman/collection.json
143+ echo >> $(POSTMAN_DIR ) /collection.json
123144 rm $(POSTMAN_DIR ) /eligibility-signposting-api.yaml
124145# ==============================================================================
125146
0 commit comments