refactor: restructure project and implement CLI framework
This commit is contained in:
40 files changed
+46
-40
No files matched your search
@@ -39,7 +39,7 @@ jobs:
|
||||
|
||||
- name: Test CLI import
|
||||
run: |
|
||||
python -c "from src.generator import main; print('Import successful')"
|
||||
python -c "from djinit.generator import main; print('Import successful')"
|
||||
|
||||
- name: Test console script entry point
|
||||
run: |
|
||||
|
||||
+2
-2
@@ -39,5 +39,5 @@ dependencies = [
|
||||
Homepage = "https://github.com/S4NKALP/djinit"
|
||||
|
||||
[project.scripts]
|
||||
djinit = "src.generator:main"
|
||||
dj = "src.generator:main"
|
||||
djinit = "djinit.generator:main"
|
||||
dj = "djinit.generator:main"
|
||||
@@ -9,16 +9,22 @@ setup(
|
||||
author="Sankalp Tharu",
|
||||
author_email="sankalptharu50028@gmail.com",
|
||||
url="https://github.com/S4NKALP/djinit",
|
||||
packages=find_packages(include=["src", "src.*"]),
|
||||
packages=find_packages(where="src"),
|
||||
package_dir={"": "src"},
|
||||
include_package_data=True,
|
||||
install_requires=[
|
||||
"ruff>=0.14.2",
|
||||
"click>=8.3.0",
|
||||
"rich>=14.2.0",
|
||||
"jinja2>=3.1.0",
|
||||
# "django<=5.2.7",
|
||||
"django>=4.2,<6.0",
|
||||
],
|
||||
entry_points={"console_scripts": ["djinit=src.generator:main"]},
|
||||
entry_points={
|
||||
"console_scripts": [
|
||||
"djinit=djinit.generator:main",
|
||||
"dj=djinit.generator:main",
|
||||
]
|
||||
},
|
||||
classifiers=[
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 3",
|
||||
|
||||
File renamed without changes.
@@ -6,13 +6,13 @@ Coordinates between different managers to create a complete Django project.
|
||||
import os
|
||||
from typing import Callable, List, Tuple
|
||||
|
||||
from src.scripts.cicd_config_generator import CICDConfigGenerator
|
||||
from src.scripts.console_ui import UIFormatter
|
||||
from src.scripts.deployment_files_generator import DeploymentConfigGenerator
|
||||
from src.scripts.files import FileManager
|
||||
from src.scripts.project import ProjectManager
|
||||
from src.scripts.secretkey_generator import generate_secret_command
|
||||
from src.scripts.settings import SettingsManager
|
||||
from djinit.scripts.cicd_config_generator import CICDConfigGenerator
|
||||
from djinit.scripts.console_ui import UIFormatter
|
||||
from djinit.scripts.deployment_files_generator import DeploymentConfigGenerator
|
||||
from djinit.scripts.files import FileManager
|
||||
from djinit.scripts.project import ProjectManager
|
||||
from djinit.scripts.secretkey_generator import generate_secret_command
|
||||
from djinit.scripts.settings import SettingsManager
|
||||
|
||||
|
||||
class Cli:
|
||||
@@ -7,10 +7,10 @@ import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from src.cli import Cli
|
||||
from src.scripts.command_handler import handle_app_command, handle_secret_command, parse_arguments
|
||||
from src.scripts.console_ui import UIFormatter, console
|
||||
from src.scripts.input_handler import confirm_setup, get_user_input
|
||||
from djinit.cli import Cli
|
||||
from djinit.scripts.command_handler import handle_app_command, handle_secret_command, parse_arguments
|
||||
from djinit.scripts.console_ui import UIFormatter, console
|
||||
from djinit.scripts.input_handler import confirm_setup, get_user_input
|
||||
|
||||
|
||||
def clear_screen() -> None:
|
||||
File renamed without changes.
@@ -7,9 +7,9 @@ import os
|
||||
import subprocess
|
||||
from typing import Optional
|
||||
|
||||
from src.scripts.console_ui import UIFormatter
|
||||
from src.scripts.template_engine import template_engine
|
||||
from src.utils import change_cwd, create_file_with_content
|
||||
from djinit.scripts.console_ui import UIFormatter
|
||||
from djinit.scripts.template_engine import template_engine
|
||||
from djinit.utils import change_cwd, create_file_with_content
|
||||
|
||||
|
||||
class AppManager:
|
||||
@@ -5,8 +5,8 @@ Handles creation of Github Actions and GitLab CI onfigurations
|
||||
|
||||
import os
|
||||
|
||||
from src.scripts.template_engine import template_engine
|
||||
from src.utils import change_cwd, create_file_with_content
|
||||
from djinit.scripts.template_engine import template_engine
|
||||
from djinit.utils import change_cwd, create_file_with_content
|
||||
|
||||
|
||||
class CICDConfigGenerator:
|
||||
@@ -6,8 +6,8 @@ Handles different commands like secret key generation and app creation.
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
from src.scripts.console_ui import UIColors, UIFormatter, console
|
||||
from src.scripts.name_validator import validate_app_name
|
||||
from djinit.scripts.console_ui import UIColors, UIFormatter, console
|
||||
from djinit.scripts.name_validator import validate_app_name
|
||||
|
||||
|
||||
def parse_arguments() -> argparse.Namespace:
|
||||
@@ -43,7 +43,7 @@ def parse_arguments() -> argparse.Namespace:
|
||||
|
||||
|
||||
def handle_secret_command(args: argparse.Namespace) -> None:
|
||||
from src.scripts.secretkey_generator import display_secret_keys, generate_multiple_keys
|
||||
from djinit.scripts.secretkey_generator import display_secret_keys, generate_multiple_keys
|
||||
|
||||
# Generate keys
|
||||
keys = generate_multiple_keys(args.count, args.length)
|
||||
@@ -70,7 +70,7 @@ def handle_secret_command(args: argparse.Namespace) -> None:
|
||||
|
||||
|
||||
def handle_app_command(args: argparse.Namespace) -> None:
|
||||
from src.scripts.app_generator import AppManager
|
||||
from djinit.scripts.app_generator import AppManager
|
||||
|
||||
# Display welcome message
|
||||
UIFormatter.print_info("")
|
||||
File renamed without changes.
+2
-2
@@ -3,8 +3,8 @@ Deployment file generator for djinit.
|
||||
Handles creation of Justfile, Procfile, and deployment-related files.
|
||||
"""
|
||||
|
||||
from src.scripts.template_engine import template_engine
|
||||
from src.utils import change_cwd, create_file_with_content
|
||||
from djinit.scripts.template_engine import template_engine
|
||||
from djinit.utils import change_cwd, create_file_with_content
|
||||
|
||||
|
||||
class DeploymentConfigGenerator:
|
||||
@@ -5,8 +5,8 @@ Handles creation and modification of project files.
|
||||
|
||||
import os
|
||||
|
||||
from src.scripts.template_engine import template_engine
|
||||
from src.utils import change_cwd, create_file_with_content
|
||||
from djinit.scripts.template_engine import template_engine
|
||||
from djinit.utils import change_cwd, create_file_with_content
|
||||
|
||||
|
||||
class FileManager:
|
||||
@@ -11,8 +11,8 @@ from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
from typing import Callable, Tuple
|
||||
|
||||
from src.scripts.console_ui import UIColors, UIFormatter, console
|
||||
from src.scripts.name_validator import validate_app_name, validate_project_name
|
||||
from djinit.scripts.console_ui import UIColors, UIFormatter, console
|
||||
from djinit.scripts.name_validator import validate_app_name, validate_project_name
|
||||
|
||||
|
||||
class CICDOption(Enum):
|
||||
File renamed without changes.
@@ -8,8 +8,8 @@ import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from src.scripts.console_ui import UIFormatter
|
||||
from src.utils import change_cwd
|
||||
from djinit.scripts.console_ui import UIFormatter
|
||||
from djinit.utils import change_cwd
|
||||
|
||||
|
||||
class ProjectManager:
|
||||
@@ -12,7 +12,7 @@ from rich.panel import Panel
|
||||
from rich.table import Table
|
||||
from rich.text import Text
|
||||
|
||||
from src.scripts.console_ui import UIColors
|
||||
from djinit.scripts.console_ui import UIColors
|
||||
|
||||
console = Console()
|
||||
|
||||
@@ -5,10 +5,10 @@ Handles creation and configuration of Django settings files.
|
||||
|
||||
import os
|
||||
|
||||
from src.scripts.console_ui import UIFormatter
|
||||
from src.scripts.secretkey_generator import generate_secret_key
|
||||
from src.scripts.template_engine import template_engine
|
||||
from src.utils import change_cwd, create_file_with_content
|
||||
from djinit.scripts.console_ui import UIFormatter
|
||||
from djinit.scripts.secretkey_generator import generate_secret_key
|
||||
from djinit.scripts.template_engine import template_engine
|
||||
from djinit.utils import change_cwd, create_file_with_content
|
||||
|
||||
|
||||
class SettingsManager:
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -7,7 +7,7 @@ import os
|
||||
import subprocess
|
||||
from contextlib import contextmanager
|
||||
|
||||
from src.scripts.console_ui import UIFormatter
|
||||
from djinit.scripts.console_ui import UIFormatter
|
||||
|
||||
|
||||
def format_file(filename: str) -> None:
|
||||
Reference in new issue
Block a user