forked from polyjitter/vrchatapi-elixir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate.sh
executable file
·55 lines (38 loc) · 1.71 KB
/
generate.sh
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
#!/bin/bash
set -e
npm install @openapitools/openapi-generator-cli
rm lib test config *.exs *.lock -rf
./node_modules/\@openapitools/openapi-generator-cli/main.js generate \
-g elixir \
--additional-properties="packageName=vrchat,invokerPackage=VRChat" \
--git-user-id=vrchatapi \
--git-repo-id=vrchat-elixir \
-o . \
-i https://raw.githubusercontent.com/vrchatapi/specification/gh-pages/openapi.yaml \
--http-user-agent="vrchatapi-elixir"
# Rename config key
sed -i "s/vr_chat_api_documentation/vrchat/" ./config/config.exs
sed -i "s/VR_CHAT_API_DOCUMENTATION/VRCHAT/" ./config/runtime.exs
sed -i "s/vr_chat_api_documentation/vrchat/" ./config/runtime.exs
sed -i "s/vr_chat_api_documentation/vrchat/" ./lib/vr_chat/connection.ex
# Rename folder
mv ./lib/vr_chat ./lib/vrchat
sed -i "s/vr_chat/vrchat/g" ./.openapi-generator/FILES
sed -i "s/Elixir/vrchat-elixir/" ./lib/vrchat/connection.ex
find . -type f -name "*.ex" -exec sed -i "s/VRChat.Api./VRChat./g" {} \;
find . -type f -name "*.ex" -exec sed -i "s/VRChat.Model.String/String/g" {} \;
cp ./patches/middleware.ex ./lib/vrchat/middleware.ex
git apply --whitespace=fix patches/dependencies.patch
mix deps.get
git apply --whitespace=fix patches/connection.patch
mix format
git apply --whitespace=fix patches/authentication.patch
mix format
mix compile
sed -i "s/vrchat-elixir/Elixir/" ./README.md
version=$(cat ./mix.exs | grep "version: " | cut -d '"' -f 2)
sed -i "s/\"~> [0-9]\+\.[0-9]\+\.[0-9]\+\"/\"~> $version\"/" README.md
sed -zi 's/\(description:\n\)[^\n]*/description: "VRChat API for Elixir",/' mix.exs
git apply --whitespace=fix patches/mix.patch
# Set up cookie based authentication
# git apply --ignore-space-change --ignore-whitespace ./patches/cookies.patch