Skip to content

Commit 9773211

Browse files
committed
AYS-909 | Format setup guide in markdown and update setup.sh
1 parent db94b25 commit 9773211

File tree

2 files changed

+58
-39
lines changed

2 files changed

+58
-39
lines changed

README.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,6 @@
7373

7474
The project has been generated by Spring Initializer.
7575

76-
## Instructions Before Building Project
77-
78-
⚠ Make sure NOT to push `template-settings.xml` at all times. ⚠
79-
80-
First of all, generate personal access token with this url : https://github.com/settings/tokens
81-
82-
- Create one classic token
83-
- Make sure to give project, read:packages, repo scopes
84-
- Give it a name
85-
- Then click on "Generate Token"
86-
- In case of errors, please check [here](#Common Maven errors)
87-
8876
# Setup Project
8977

9078
Run the following command to set up the project:
@@ -93,8 +81,28 @@ Run the following command to set up the project:
9381
sh setup/setup.sh
9482
```
9583

84+
`⚠ Windows Users: Please make sure to run the command inside Git Bash terminal (not PowerShell or CMD).`
85+
86+
During the setup process, you will be asked whether you already have a GitHub Personal Access Token.
87+
88+
- If you already have one, just paste it.
89+
90+
- If not, the script will guide you to generate a new one.
91+
9692
#### Don't forget to enable Lombok pre-processing in your IDE!
9793

94+
## Generate GitHub Personal Access Token (Optional)
95+
96+
If you prefer to create a token manually before running the setup:
97+
- Go to : https://github.com/settings/tokens
98+
- Create one classic token
99+
- Make sure to give project, read:packages, repo scopes
100+
- Give it a name
101+
- Then click on "Generate Token"
102+
- In case of errors, please check [here](#Common Maven errors)
103+
104+
⚠ Copy your token somewhere safe, you will need it during setup.
105+
98106
## Running as Docker MySQL container
99107

100108
Before running the project, you need to run the following command to start the MySQL container:
@@ -157,7 +165,7 @@ Page.
157165

158166
## Postman
159167

160-
### [Documentation](https://documenter.getpostman.com/view/26813504/2s93kz55Jz) & [Workspace](https://www.postman.com/afetyonetimsistemi/workspace/api)
168+
### [Documentation](https://documenter.getpostman.com/view/26813504/2s93kz55Jz) & [Workspace](https://www.postman.com/ays-team/api)
161169

162170
---
163171

setup/setup.sh

Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -47,33 +47,44 @@ if [[ "$IS_OVERWRITE" == true ]]; then
4747

4848
while true; do
4949
echo "\033[97m"
50-
read -p "➡️ Enter your GitHub Access Token (press enter for creating) : " YOUR_PERSONAL_GITHUB_ACCESS_TOKEN
51-
if [[ -n "$YOUR_PERSONAL_GITHUB_ACCESS_TOKEN" ]]; then
52-
break
53-
fi
54-
55-
echo ""
56-
echo "\033[96mPress Enter to open browser for creating a new Personal Access Token...\033[0m"
57-
read -p "" _
58-
59-
if command -v xdg-open >/dev/null; then
60-
xdg-open "https://github.com/settings/tokens/new"
61-
elif command -v open >/dev/null; then
62-
open "https://github.com/settings/tokens/new"
63-
else
64-
echo "Please open the following URL in your browser to create a new Personal Access Token: "
65-
echo " https://github.com/settings/tokens/new"
66-
fi
67-
68-
while true; do
69-
echo "\033[97m"
70-
read -p "➡️ Paste your Personal Access Token here: " YOUR_PERSONAL_GITHUB_ACCESS_TOKEN
71-
if [[ -n "$YOUR_PERSONAL_GITHUB_ACCESS_TOKEN" ]]; then
50+
read -p "➡️ Do you already have a GitHub Access Token? (y/n): " has_token
51+
case "$has_token" in
52+
[Yy]* )
53+
while true; do
54+
echo "\033[97m"
55+
read -p "➡️ Enter your GitHub Access Token: " YOUR_PERSONAL_GITHUB_ACCESS_TOKEN
56+
if [[ -n "$YOUR_PERSONAL_GITHUB_ACCESS_TOKEN" ]]; then
57+
break
58+
fi
59+
echo "\033[41mPlease enter your GitHub Access Token.\033[0m"
60+
done
61+
break
62+
;;
63+
[Nn]* )
64+
echo "\033[96m➡️ Press Enter for creating Token:\033[0m"
65+
read -p "" _
66+
if command -v xdg-open >/dev/null; then
67+
xdg-open "https://github.com/settings/tokens/new"
68+
elif command -v open >/dev/null; then
69+
open "https://github.com/settings/tokens/new"
70+
else
71+
echo "Please open the following URL in your browser to create a new Personal Access Token: "
72+
echo " https://github.com/settings/tokens/new"
73+
fi
74+
while true; do
75+
echo "\033[97m"
76+
read -p "➡️ Paste your Personal Access Token: " YOUR_PERSONAL_GITHUB_ACCESS_TOKEN
77+
if [[ -n "$YOUR_PERSONAL_GITHUB_ACCESS_TOKEN" ]]; then
78+
break
79+
fi
80+
echo "\033[41mPlease paste your Personal Access Token.\033[0m"
81+
done
7282
break
73-
fi
74-
echo "\033[41mPlease paste your Personal Access Token.\033[0m"
75-
done
76-
break
83+
;;
84+
* )
85+
echo "Invalid choice, please enter 'y' or 'n'."
86+
;;
87+
esac
7788
done
7889
echo "\033[0m"
7990

0 commit comments

Comments
 (0)