Skip to content

Commit b310da8

Browse files
authored
Merge pull request KalleHallden#4 from AndrewMayes/master
Abstracting away the user specific information (username,password,path)
2 parents 8e3030c + 08e12a7 commit b310da8

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

.my_commands.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
function create() {
44
cd
5+
source .env
56
python create.py $1
6-
cd /Users/kalle/Documents/Projects/MyProjects/$1
7+
cd $FILEPATH$1
78
git init
8-
git remote add origin [email protected]:KalleHallden/$1.git
9+
git remote add origin [email protected]:$USERNAME/$1.git
910
touch README.md
1011
git add .
1112
git commit -m "Initial commit"
1213
git push -u origin master
1314
code .
14-
}
15+
}

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,19 @@
33
git clone "https://github.com/KalleHallden/ProjectInitializationAutomation.git"
44
cd ProjectInitializationAutomation
55
pip install -r requirements.txt
6+
touch .env
7+
Then open the .env file and store your username, password, and desired file destination. Use the provided format at the bottom of this README.
68
source ~/.my_commands.sh
7-
Then go to create.py and set the username and password to be your username and password.
8-
Also make sure to change all directories to your directories so it should be '/Users/<your username>/path/to/your/project'
99
```
1010

1111
### Usage:
1212
```bash
1313
To run the script type in 'create <name of your folder>'
1414
```
15+
16+
### Env File Format:
17+
```bash
18+
USERNAME="Username123"
19+
PASSWORD="Password123"
20+
FILEPATH="/path/to/your/project/"
21+
```

create.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import sys
22
import os
33
from github import Github
4+
from dotenv import load_dotenv
45

5-
path = "/Users/kalle/Documents/Projects/MyProjects/"
6+
load_dotenv()
67

7-
username = "" #Insert your github username here
8-
password = "" #Insert your github password here
8+
path = os.getenv("FILEPATH")
9+
username = os.getenv("USERNAME")
10+
password = os.getenv("PASSWORD")
911

1012
def create():
1113
folderName = str(sys.argv[1])

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
selenium
22
PyGithub
3+
python-dotenv

0 commit comments

Comments
 (0)