Skip to content

Commit f0a4f7b

Browse files
committed
v4.0
1 parent 4d16dc9 commit f0a4f7b

File tree

7 files changed

+37
-21
lines changed

7 files changed

+37
-21
lines changed

.vs/ProjectSettings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"CurrentProjectSetting": null
3+
}

.vs/VSWorkspaceState.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"ExpandedNodes": [
3+
""
4+
],
5+
"PreviewInSolutionExplorer": false
6+
}

.vs/create_structure/v16/.suo

15.5 KB
Binary file not shown.

.vs/slnx.sqlite

88 KB
Binary file not shown.

bin/create_structure.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
from getpass import getpass
99
import requests
1010

11-
__author__ = "davidecastellani@castellanidavide.it", "chiara@sabaini.com"
12-
__version__ = "3.1 2020-08-18"
11+
__author__ = "help@castellanidavide.it"
12+
__version__ = "4.0 2020-09-25"
13+
14+
TOKEN = "<INSERT_YOUR_TOKEN>"
1315

1416
class create_structure:
1517
def __init__ (self):
@@ -20,17 +22,16 @@ def __init__ (self):
2022
"Inserisci una descrizione del progetto: ", #2
2123
"Il progetto è con Boscaini (<nome della classe>-<numero consegna>), Bellini (b) o qualcunaltro(lasciare vuoto)? ", #3
2224
"Questo progetto è con la Chiara?(Y/N): ", #4
23-
"Questo progetto è privato?(Y/N): ", #5
24-
"Inserisci il tuo username di GitHub: ", #6
25-
"Inserisci la tua password su GitHub: " #7
25+
"Questo progetto è privato?(Y/N): ", #5 #7
2626
]
2727
results = []
2828

2929
for i, current_quest in enumerate(questions):
30-
if i == len(questions) - 1:
30+
"""if i == len(questions) - 1:
3131
results.append(getpass(prompt=current_quest))
3232
else:
33-
results.append(input(current_quest))
33+
results.append(input(current_quest))"""
34+
results.append(input(current_quest))
3435

3536
print()
3637

@@ -51,16 +52,13 @@ def __init__ (self):
5152
template = g.get_repo(f"CastellaniDavide/{typerepo}-template")
5253
create_structure.scan_and_elaborate(repo, template, "", typerepo, results)
5354

54-
if results[5] == "N":
55-
create_structure.download_repo(repo, folder_name)
56-
print(f"repo downloaded")
57-
else:
58-
print(f"Your repo is redy online")
55+
os.system(f"git clone git@github.com:CastellaniDavide/{results[0]}.git", shell=False)
56+
print(f"repo downloaded")
5957

6058
def login(results):
6159
"""Made the login in GitHub
6260
"""
63-
return Github(results[6], results[7])
61+
return Github(TOKEN)
6462

6563
def create_folder(directory):
6664
"""Creates a folder
@@ -75,9 +73,9 @@ def create_repo(results, g):
7573
"""Create the repo in CastellaniDavide repository
7674
"""
7775
if results[4] == "Y":
78-
repo = g.get_organization("CastellaniDavide").create_repo(results[0] if(results[3] == "") else f"{results[3]}-{results[0]}", description=results[2], private=results[5] == "Y", has_issues=True, has_wiki=False, has_downloads=True, has_projects=False, team_id=4008430)
76+
repo = g.get_organization("CastellaniDavide").create_repo(results[0] if(results[3] == "" or results[3] == "b") else f"{results[3]}-{results[0]}", description=results[2], private=results[5] == "Y", has_issues=True, has_wiki=False, has_downloads=True, has_projects=False, team_id=4008430)
7977
else:
80-
repo = g.get_organization("CastellaniDavide").create_repo(results[0] if(results[3] == "") else f"{results[3]}-{results[0]}", description=results[2], private=results[5] == "Y", has_issues=True, has_wiki=False, has_downloads=True, has_projects=False)
78+
repo = g.get_organization("CastellaniDavide").create_repo(results[0] if(results[3] == "" or results[3] == "b") else f"{results[3]}-{results[0]}", description=results[2], private=results[5] == "Y", has_issues=True, has_wiki=False, has_downloads=True, has_projects=False)
8179

8280
return repo
8381

@@ -140,6 +138,7 @@ def download_repo(repo, folder_name):
140138
pygit2.clone_repository(repo.git_url, folder_name)
141139

142140
if __name__ == "__main__":
141+
assert(TOKEN == "<INSERT_YOUR_TOKEN>", "You must to put your tocken into TOKEN variable")
143142
try:
144143
create_structure()
145144
except:

docs/README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
# create_structure
2-
[![GitHub license](https://img.shields.io/badge/licence-GNU-green?style=flat)](https://github.com/CastellaniDavide/cpp-create_structure/blob/master/LICENSE) ![Author](https://img.shields.io/badge/author-Castellani%20Davide-green?style=flat) ![Version](https://img.shields.io/badge/version-v3.1-blue?style=flat) ![Language Python](https://img.shields.io/badge/language-Python-yellowgreen?style=flat) ![sys.platform supported](https://img.shields.io/badge/OS%20platform%20supported-Linux,%20Windows%20&%20Mac%20OS-blue?style=flat) [![On GitHub](https://img.shields.io/badge/on%20GitHub-True-green?style=flat&logo=github)](https://github.com/CastellaniDavide/create_structure)
2+
[![GitHub license](https://img.shields.io/badge/licence-GNU-green?style=flat)](https://github.com/CastellaniDavide/cpp-create_structure/blob/master/LICENSE) ![Author](https://img.shields.io/badge/author-Castellani%20Davide-green?style=flat) ![Version](https://img.shields.io/badge/version-v4.0-blue?style=flat) ![Language Python](https://img.shields.io/badge/language-Python-yellowgreen?style=flat) ![sys.platform supported](https://img.shields.io/badge/OS%20platform%20supported-Linux,%20Windows%20&%20Mac%20OS-blue?style=flat) [![On GitHub](https://img.shields.io/badge/on%20GitHub-True-green?style=flat&logo=github)](https://github.com/CastellaniDavide/create_structure)
33

44
# Description
5-
This is the magic "robottino" by Castellani Davide & Sabaini Chiara
5+
This is the magic "robottino" by Castellani Davide & (Sabaini Chiara (v1.0 only))
66

77
## Required
88
- python3
99
- some pip pakeges, to install it go in requirements folder and execute: pip3 install -r requirements.txt
1010
- Internet connection
11+
- git
1112
- GitHub account
13+
- [GitHub Token](https://github.com/settings/tokens) with repo permission, PUT IT INTO TOKEN VARIABLESA
14+
- [GitHub SSH keys](https://docs.github.com/en/free-pro-team@latest/github/using-git/which-remote-url-should-i-use#cloning-with-ssh-urls)
1215

1316
## Directories structure
1417
- .github
@@ -20,20 +23,26 @@ This is the magic "robottino" by Castellani Davide & Sabaini Chiara
2023
- doc
2124
- LICENSE
2225
- README.md
23-
- log
24-
- trace.log
2526
- requirements
2627
- requirements.txt
2728

2829
### Execution examples
2930
- python3 create_structure.py
3031

3132
# Changelog
33+
- [4.0_2020-9-25](#4.0_2020-9-25)
3234
- [3.1_2020-8-18](#3.1_2020-8-18)
3335
- [3.0_2020-8-15](#3.0_2020-8-15)
3436
- [2.0_2020-3-24](#2.0_2020-3-24)
3537
- [1.0_2020-3-24](#1.0_2020-3-24)
3638

39+
### 4.0_2020-9-25
40+
#### Changes
41+
- Fixed a bug
42+
- Remove the necessity of insert credentials any time
43+
- Download in any case, before only if public repo
44+
- removed unused files
45+
3746
### 3.1_2020-8-18
3847
#### Changes
3948
- optimized the code
@@ -55,5 +64,4 @@ This is the magic "robottino" by Castellani Davide & Sabaini Chiara
5564
Made by Castellani Davide
5665
If you have any problem please contact us:
5766
- help@castellanidavide.it
58-
- [Issue](https://github.com/CastellaniDavide/create_structure/issues)
59-
- chiara@sabaini.com
67+
- [Issue](https://github.com/CastellaniDavide/create_structure/issues)

log/trace.log

Whitespace-only changes.

0 commit comments

Comments
 (0)