-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
57 lines (43 loc) · 1.37 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
47
48
49
50
51
52
53
54
55
56
57
.PHONY: all clean codegen
.PHONE: deps compile shell
SHELL := BASH_ENV=.rc /bin/bash --noprofile
OPENAPI_CODEGEN_VERSION?=v7.8.0
OPENAPI_CODEGEN_IMAGE?=openapitools/openapi-generator-cli
OPSGENIE_OPENAPI_SPEC_REPO?=git@github.com:bougar/opsgenie-oas.git
OPSGENIE_OPENAPI_SPEC_VERSION?=master
OPSGENIE_OPENAPI_SPEC_DIR?=opsgenie-oas
all: codegen build deps compile
deps:
mix deps.get
compile:
mix compile
shell:
iex -S mix
opsgenie-oas:
git clone ${OPSGENIE_OPENAPI_SPEC_REPO} --branch ${OPSGENIE_OPENAPI_SPEC_VERSION} --depth 1
opsgenie-oas/swagger.json:
cd ${OPSGENIE_OPENAPI_SPEC_DIR}/multi-file-swagger && npm install
cd ${OPSGENIE_OPENAPI_SPEC_DIR} && ./multi-file-swagger/index.js -- swagger.yaml > swagger.json
codegen: lib/opsgeniex
lib/opsgeniex: $(OPSGENIE_OPENAPI_SPEC_DIR) $(OPSGENIE_OPENAPI_SPEC_DIR)/swagger.json
@docker run --rm -v "${PWD}:/local" ${OPENAPI_CODEGEN_IMAGE}:${OPENAPI_CODEGEN_VERSION} generate \
-i /local/opsgenie-oas/swagger.json \
--skip-validate-spec \
-g elixir \
--additional-properties=packageName=opsgeniex \
--additional-properties=invokerPackage=Opsgeniex \
-o /local/out/elixir
mv out/elixir/lib/* lib/
mv out/elixir/mix.exs .
build:
mix deps.get
mix compile
clean:
mix clean --all
mix deps.clean --all
rm -rf ${OPSGENIE_OPENAPI_SPEC_DIR}
rm -rf lib/*
rm -rf out
rm -f .openapi-generator-ignore
rm -rf _build
rm -rf doc