-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from samdoghor/myte-v0.3.0
feat: renamed and deleted templates
- Loading branch information
Showing
132 changed files
with
2,264 additions
and
3,651 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,99 +1,99 @@ | ||
# setup_project.py | ||
|
||
""" | ||
This module defines functions to create the boilerplate. | ||
""" | ||
|
||
import inquirer | ||
import typer | ||
from rich import print as mprint | ||
from rich.prompt import Prompt | ||
|
||
from .create_project import CreateProject | ||
from .delete_project import DeleteProject | ||
from ..utils.errors import UKeyboardInterrupt | ||
|
||
|
||
class SetupProject: | ||
""" This class defines the project creation """ | ||
|
||
@staticmethod | ||
def project_setup(): | ||
""" This function defines the setup for the biolerplate creation """ | ||
|
||
# get project name | ||
project_name = Prompt.ask( | ||
"Project Name", default="myte-project") | ||
mprint("\n") | ||
|
||
try: | ||
if project_name == ".": | ||
DeleteProject.delete_files() | ||
else: | ||
DeleteProject.delete_dir(project_name) | ||
mprint(f"[green] ✅ Project name: {project_name} [/green]") | ||
mprint("\n") | ||
except UKeyboardInterrupt as e: | ||
mprint(f"{e.message}") # noqa | ||
raise typer.Abort() | ||
except KeyboardInterrupt as e: | ||
mprint(f"The Programme was terminated due to {e} Error") # noqa | ||
raise typer.Abort() | ||
except TypeError as e: | ||
mprint(f"The Programme was terminated due to {e} Error") # noqa | ||
raise typer.Abort() | ||
|
||
# get framework choice | ||
try: | ||
frameworks_choice = ["Flask", "Flask-Restful-API"] | ||
frameworks = [ | ||
inquirer.List( | ||
"framework", | ||
message="Select a framework", | ||
choices=frameworks_choice, | ||
carousel=True, | ||
) | ||
] | ||
selected_framework = inquirer.prompt(frameworks) | ||
|
||
mprint(f"[green] ✅ {selected_framework['framework']}, selected [/green]") # noqa | ||
mprint("\n") | ||
except UKeyboardInterrupt as e: | ||
mprint(f"{e.message}") # noqa | ||
raise typer.Abort() | ||
except KeyboardInterrupt as e: | ||
mprint(f"The Programme was terminated due to {e} Error") # noqa | ||
raise typer.Abort() | ||
except TypeError as e: | ||
mprint(f"The Programme was terminated due to {e} Error") # noqa | ||
raise typer.Abort() | ||
|
||
# get setup choice | ||
try: | ||
setup_choice = ["Simple", "Robust"] | ||
setups = [ | ||
inquirer.List( | ||
"setup", | ||
message="Select complexity", | ||
choices=setup_choice, | ||
carousel=True, | ||
) | ||
] | ||
selected_setup = inquirer.prompt(setups) | ||
|
||
mprint(f"[green] ✅ {selected_setup['setup']}, selected [/green] ") # noqa | ||
mprint("\n") | ||
except KeyboardInterrupt as e: | ||
mprint(f"The Programme was terminated due to {e} Error") # noqa | ||
raise typer.Abort() | ||
except TypeError as e: | ||
mprint(f"The Programme was terminated due to {e} Error") # noqa | ||
raise typer.Abort() | ||
|
||
# boilerplate execution | ||
if project_name and selected_framework['framework'] and selected_setup['setup']: # noqa | ||
|
||
if project_name == ".": | ||
CreateProject.create_files(selected_framework, selected_setup) # noqa | ||
else: | ||
CreateProject.create_dir(project_name, selected_framework, selected_setup) # noqa | ||
# setup_project.py | ||
|
||
""" | ||
This module defines functions to create the boilerplate. | ||
""" | ||
|
||
import inquirer | ||
import typer | ||
from rich import print as mprint | ||
from rich.prompt import Prompt | ||
|
||
from .create_project import CreateProject | ||
from .delete_project import DeleteProject | ||
from ..utils.errors import UKeyboardInterrupt | ||
|
||
|
||
class SetupProject: | ||
""" This class defines the project creation """ | ||
|
||
@staticmethod | ||
def project_setup(): | ||
""" This function defines the setup for the biolerplate creation """ | ||
|
||
# get project name | ||
project_name = Prompt.ask( | ||
"Project Name", default="myte-project") | ||
mprint("\n") | ||
|
||
try: | ||
if project_name == ".": | ||
DeleteProject.delete_files() | ||
else: | ||
DeleteProject.delete_dir(project_name) | ||
mprint(f"[green] ✅ Project name: {project_name} [/green]") | ||
mprint("\n") | ||
except UKeyboardInterrupt as e: | ||
mprint(f"{e.message}") # noqa | ||
raise typer.Abort() | ||
except KeyboardInterrupt as e: | ||
mprint(f"The Programme was terminated due to {e} Error") # noqa | ||
raise typer.Abort() | ||
except TypeError as e: | ||
mprint(f"The Programme was terminated due to {e} Error") # noqa | ||
raise typer.Abort() | ||
|
||
# get framework choice | ||
try: | ||
frameworks_choice = ["Flask"] | ||
frameworks = [ | ||
inquirer.List( | ||
"framework", | ||
message="Select a framework", | ||
choices=frameworks_choice, | ||
carousel=True, | ||
) | ||
] | ||
selected_framework = inquirer.prompt(frameworks) | ||
|
||
mprint(f"[green] ✅ {selected_framework['framework']}, selected [/green]") # noqa | ||
mprint("\n") | ||
except UKeyboardInterrupt as e: | ||
mprint(f"{e.message}") # noqa | ||
raise typer.Abort() | ||
except KeyboardInterrupt as e: | ||
mprint(f"The Programme was terminated due to {e} Error") # noqa | ||
raise typer.Abort() | ||
except TypeError as e: | ||
mprint(f"The Programme was terminated due to {e} Error") # noqa | ||
raise typer.Abort() | ||
|
||
# get setup choice | ||
try: | ||
setup_choice = ["Fullstack", "Restful-API"] | ||
setups = [ | ||
inquirer.List( | ||
"setup", | ||
message="Select complexity", | ||
choices=setup_choice, | ||
carousel=True, | ||
) | ||
] | ||
selected_setup = inquirer.prompt(setups) | ||
|
||
mprint(f"[green] ✅ {selected_setup['setup']}, selected [/green] ") # noqa | ||
mprint("\n") | ||
except KeyboardInterrupt as e: | ||
mprint(f"The Programme was terminated due to {e} Error") # noqa | ||
raise typer.Abort() | ||
except TypeError as e: | ||
mprint(f"The Programme was terminated due to {e} Error") # noqa | ||
raise typer.Abort() | ||
|
||
# boilerplate execution | ||
if project_name and selected_framework['framework'] and selected_setup['setup']: # noqa | ||
|
||
if project_name == ".": | ||
CreateProject.create_files(selected_framework, selected_setup) # noqa | ||
else: | ||
CreateProject.create_dir(project_name, selected_framework, selected_setup) # noqa |
Oops, something went wrong.