-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
72 lines (60 loc) · 3.53 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
.PHONY: install_phoenix create_phoenix_project apply_phoenix_template create_mix_project apply_mix_template remove_nimble_template
# Y - in response to Are you sure you want to install "phx_new-${PHOENIX_VERSION}.ez"?
install_phoenix:
printf "Y\n" | mix archive.install hex phx_new ${PHOENIX_VERSION}
create_phoenix_project:
mix phx.new ${PROJECT_DIRECTORY} ${OPTIONS}
create_mix_project:
mix new ${PROJECT_DIRECTORY} ${OPTIONS}
# Y - in response to Will you host this project on Github?
# Y - in response to Do you want to generate the .github/ISSUE_TEMPLATE and .github/PULL_REQUEST_TEMPLATE?
# Y - in response to Do you want to generate the Github Action workflows: Test?
# Y - in response to Do you want to generate the Github Action workflows: Deploy to Heroku?
# Y - in response to Do you want to generate the .github/.workflow/README file?
# Y - in response to Do you want to publish a Github Wiki for this project? You'd need to manually create the first Github Wiki Page and set the GH_TOKEN and GH_EMAIL secret for this to properly function.
# Y - in response to Would you like to add the Oban addon?
# Y - in response to Would you like to add the ExVCR addon?
common_addon_prompts = Y\nY\nY\nY\nY\nY\nY\nY\n
# Y - in response to Would you like to add the SVG Sprite addon?
# Y - in response to Would you like to add the Dart Sass addon?
# Y - in response to Would you like to add the Nimble CSS addon?
# Y - in response to Would you like to add the Nimble JS addon?
# Y - in response to Would you like to add the Boostrap addon?
web_addon_prompts = Y\nY\nY\nY\nY\n
api_addon_prompts =
live_addon_prompts =
# Y - in response to Will you host this project on Github?
# Y - in response to Do you want to generate the .github/ISSUE_TEMPLATE and .github/PULL_REQUEST_TEMPLATE?
# Y - in response to Do you want to generate the Github Action workflow: Test?
# Y - in response to Do you want to generate the .github/.workflow/README file?
# Y - in response to Do you want to publish a Github Wiki for this project? You'd need to manually create the first Github Wiki Page and set the GH_TOKEN and GH_EMAIL secret for this to properly function.
# Y - in response to Would you like to add the Mimic addon?
mix_addon_prompts = Y\nY\nY\nY\nY\nY\n
post_setup_addon_prompts =
apply_phoenix_template:
cd ${PROJECT_DIRECTORY} && \
echo '{:nimble_template, path: "../", only: :dev, runtime: false},' > nimble_template.txt && \
sed -i -e '/{:phoenix, "~> /r nimble_template.txt' mix.exs && \
rm nimble_template.txt && \
export MIX_ENV=dev && \
mix do deps.get, deps.compile && \
mix format && \
if [ $(VARIANT) = web ]; then \
printf "${common_addon_prompts}${web_addon_prompts}${post_setup_addon_prompts}" | mix nimble_template.gen --web; \
elif [ $(VARIANT) = api ]; then \
printf "${common_addon_prompts}${api_addon_prompts}${post_setup_addon_prompts}" | mix nimble_template.gen --api; \
elif [ $(VARIANT) = live ]; then \
printf "${common_addon_prompts}${web_addon_prompts}${live_addon_prompts}${post_setup_addon_prompts}" | mix nimble_template.gen --live; \
fi;
apply_mix_template:
cd ${PROJECT_DIRECTORY} && \
echo '{:nimble_template, path: "../", only: :dev, runtime: false}' > nimble_template.txt && \
sed -i -e '/# {:dep_from_git, /r nimble_template.txt' mix.exs && \
rm nimble_template.txt && \
export MIX_ENV=dev && \
mix do deps.get, deps.compile && \
mix format && \
printf "${mix_addon_prompts}${post_setup_addon_prompts}" | mix nimble_template.gen --mix; \
remove_nimble_template:
cd ${PROJECT_DIRECTORY} && \
sed -i -e 's/{:nimble_template, path: "..\/"},//' mix.exs