Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/runner.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import os


def runner():
if os.path.isdir('src'):
if os.path.isdir("src"):
try:
os.system('pip3 install -r requirements.txt')
os.chdir('src')
os.system('python3 main.py')
os.system("pip3 install -r requirements.txt")
os.chdir("src")
os.system("python3 main.py")
except:
print("ERROR")
else:
print('No src folder found')
print("No src folder found")


if __name__ == '__main__':
runner()
if __name__ == "__main__":
runner()
54 changes: 38 additions & 16 deletions src/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,53 @@ def create_new_file_folder(appName: str):
:param appName: Name of Your app that you want to create
:return: Project file
"""
os.mkdir('src')
with open('/Users/anton/Desktop/Development/Python/fleet-create-app/templates/main.template', 'r') as f, open('src/main.py', 'w') as fw:
os.mkdir("src")
with open(
"/Users/anton/Desktop/Development/Python/fleet-create-app/templates/main.template",
"r",
) as f, open("src/main.py", "w") as fw:
for line in f:

fw.write(line)


def create_git_ignore():

with open('/Users/anton/Desktop/Development/Python/fleet-create-app/templates/gitignore.template', 'r') as f, open('.gitignore', 'w') as fw:
with open(
"/Users/anton/Desktop/Development/Python/fleet-create-app/templates/gitignore.template",
"r",
) as f, open(".gitignore", "w") as fw:
for line in f:

fw.write(line)


def create_requirements():

with open('/Users/anton/Desktop/Development/Python/fleet-create-app/templates/requirements.template', 'r') as f, open('requirements.txt', 'w') as fw:
with open(
"/Users/anton/Desktop/Development/Python/fleet-create-app/templates/requirements.template",
"r",
) as f, open("requirements.txt", "w") as fw:
for line in f:

fw.write(line)


def create_license():
with open('/Users/anton/Desktop/Development/Python/fleet-create-app/templates/LICENSE.template', 'r') as f, open('LICENSE', 'w') as fw:
with open(
"/Users/anton/Desktop/Development/Python/fleet-create-app/templates/LICENSE.template",
"r",
) as f, open("LICENSE", "w") as fw:
for line in f:
fw.write(line)


def create_readme(appName: str):
with open('/Users/anton/Desktop/Development/Python/fleet-create-app/templates/README.template', 'r') as f, open('README.md', 'w') as fw:
fw.write(f'# {appName}')
with open(
"/Users/anton/Desktop/Development/Python/fleet-create-app/templates/README.template",
"r",
) as f, open("README.md", "w") as fw:
fw.write(f"# {appName}")
fw.write("\n")

for line in f:
Expand All @@ -47,30 +65,32 @@ def create_readme(appName: str):

def project_creator(Project_name: str):

os.mkdir(f'{Project_name}')
os.chdir(f'{Project_name}')
os.mkdir(f"{Project_name}")
os.chdir(f"{Project_name}")
create_new_file_folder(appName=Project_name)
create_git_ignore()
create_requirements()
create_readme(appName=Project_name)
create_license()


def runner():
if os.path.isdir('src'):
if os.path.isdir("src"):
try:
os.system('pip3 install -r requirements.txt')
os.chdir('src')
os.system('python3 main.py')
os.system("pip3 install -r requirements.txt")
os.chdir("src")
os.system("python3 main.py")
except:
print("ERROR")
else:
print('No src folder found')
print("No src folder found")


# CLI EXECUTION

app = typer.Typer()


@app.command()
def create(name: str):
start_time = time.time()
Expand All @@ -86,9 +106,11 @@ def create(name: str):
print("\n")
print(f"Your application code is in {name}/src/main.py")


@app.command()
def run():
runner()

if __name__ == '__main__':
app()

if __name__ == "__main__":
app()
37 changes: 27 additions & 10 deletions src/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,53 @@ def create_new_file_folder(appName: str):
:param appName: Name of Your app that you want to create
:return: Project file
"""
os.mkdir('src')
with open('/Users/anton/Desktop/Development/Python/fleet-create-app/templates/main.template', 'r') as f, open('src/main.py', 'w') as fw:
os.mkdir("src")
with open(
"/Users/anton/Desktop/Development/Python/fleet-create-app/templates/main.template",
"r",
) as f, open("src/main.py", "w") as fw:
for line in f:

fw.write(line)


def create_git_ignore():

with open('/Users/anton/Desktop/Development/Python/fleet-create-app/templates/gitignore.template', 'r') as f, open('.gitignore', 'w') as fw:
with open(
"/Users/anton/Desktop/Development/Python/fleet-create-app/templates/gitignore.template",
"r",
) as f, open(".gitignore", "w") as fw:
for line in f:

fw.write(line)


def create_requirements():

with open('/Users/anton/Desktop/Development/Python/fleet-create-app/templates/requirements.template', 'r') as f, open('requirements.txt', 'w') as fw:
with open(
"/Users/anton/Desktop/Development/Python/fleet-create-app/templates/requirements.template",
"r",
) as f, open("requirements.txt", "w") as fw:
for line in f:

fw.write(line)


def create_license():
with open('/Users/anton/Desktop/Development/Python/fleet-create-app/templates/LICENSE.template', 'r') as f, open('LICENSE', 'w') as fw:
with open(
"/Users/anton/Desktop/Development/Python/fleet-create-app/templates/LICENSE.template",
"r",
) as f, open("LICENSE", "w") as fw:
for line in f:
fw.write(line)


def create_readme(appName: str):
with open('/Users/anton/Desktop/Development/Python/fleet-create-app/templates/README.template', 'r') as f, open('README.md', 'w') as fw:
fw.write(f'# {appName}')
with open(
"/Users/anton/Desktop/Development/Python/fleet-create-app/templates/README.template",
"r",
) as f, open("README.md", "w") as fw:
fw.write(f"# {appName}")
fw.write("\n")

for line in f:
Expand All @@ -44,11 +62,10 @@ def create_readme(appName: str):

def project_creator(Project_name: str):

os.mkdir(f'{Project_name}')
os.chdir(f'{Project_name}')
os.mkdir(f"{Project_name}")
os.chdir(f"{Project_name}")
create_new_file_folder(appName=Project_name)
create_git_ignore()
create_requirements()
create_readme(appName=Project_name)
create_license()

2 changes: 1 addition & 1 deletion tests/test.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Test TDB
# Test TDB