chore: bump version to 0.3.0
This commit is contained in:
8 files changed
+19
-10
No files matched your search
+1
-1
@@ -84,7 +84,7 @@ class Cli:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
with progress:
|
with progress:
|
||||||
for step_number, (description, step_func) in enumerate(steps, 1):
|
for step_number, (_, step_func) in enumerate(steps, 1):
|
||||||
step_func()
|
step_func()
|
||||||
progress.update(task, advance=1, description=f"Step {step_number}/{total_steps}")
|
progress.update(task, advance=1, description=f"Step {step_number}/{total_steps}")
|
||||||
|
|
||||||
|
|||||||
@@ -58,11 +58,13 @@ class ProjectManager:
|
|||||||
|
|
||||||
if not os.path.exists(base_settings_path):
|
if not os.path.exists(base_settings_path):
|
||||||
from djinit.utils.exceptions import ConfigError
|
from djinit.utils.exceptions import ConfigError
|
||||||
|
|
||||||
raise ConfigError("Could not find base.py settings file")
|
raise ConfigError("Could not find base.py settings file")
|
||||||
|
|
||||||
content = read_base_settings(self.project_root, self.module_name)
|
content = read_base_settings(self.project_root, self.module_name)
|
||||||
if content is None:
|
if content is None:
|
||||||
from djinit.utils.exceptions import ConfigError
|
from djinit.utils.exceptions import ConfigError
|
||||||
|
|
||||||
raise ConfigError("Could not read base.py settings file")
|
raise ConfigError("Could not read base.py settings file")
|
||||||
|
|
||||||
app_module_paths = calculate_app_module_paths(self.app_names, self.metadata)
|
app_module_paths = calculate_app_module_paths(self.app_names, self.metadata)
|
||||||
@@ -77,6 +79,7 @@ class ProjectManager:
|
|||||||
updated_content = insert_apps_into_user_defined_apps(content, apps_to_add)
|
updated_content = insert_apps_into_user_defined_apps(content, apps_to_add)
|
||||||
if not updated_content:
|
if not updated_content:
|
||||||
from djinit.utils.exceptions import ConfigError
|
from djinit.utils.exceptions import ConfigError
|
||||||
|
|
||||||
raise ConfigError("Could not update USER_DEFINED_APPS in base.py")
|
raise ConfigError("Could not update USER_DEFINED_APPS in base.py")
|
||||||
|
|
||||||
with open(base_settings_path, "w") as f:
|
with open(base_settings_path, "w") as f:
|
||||||
@@ -149,6 +152,7 @@ class ProjectManager:
|
|||||||
UIFormatter.print_error("Project structure validation failed:")
|
UIFormatter.print_error("Project structure validation failed:")
|
||||||
for file_path in missing_files:
|
for file_path in missing_files:
|
||||||
UIFormatter.print_error(f" Missing: {file_path}")
|
UIFormatter.print_error(f" Missing: {file_path}")
|
||||||
|
|
||||||
from djinit.utils.exceptions import ConfigError
|
from djinit.utils.exceptions import ConfigError
|
||||||
|
|
||||||
raise ConfigError("Project structure validation failed", details=f"Missing files: {missing_files}")
|
raise ConfigError("Project structure validation failed", details=f"Missing files: {missing_files}")
|
||||||
@@ -24,7 +24,7 @@ def create_file_with_content(filename: str, content: str, success_message: str,
|
|||||||
with open(filename, "w") as file:
|
with open(filename, "w") as file:
|
||||||
file.write(content)
|
file.write(content)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
raise FileError(f"Failed to write file: {filename}", details=str(e))
|
raise FileError(f"Failed to write file: {filename}", details=str(e)) from e
|
||||||
|
|
||||||
if should_format:
|
if should_format:
|
||||||
format_file(filename)
|
format_file(filename)
|
||||||
@@ -43,7 +43,8 @@ def create_file_from_template(
|
|||||||
content = template_engine.render_template(template_path, context)
|
content = template_engine.render_template(template_path, context)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
from djinit.utils.exceptions import TemplateError
|
from djinit.utils.exceptions import TemplateError
|
||||||
raise TemplateError(f"Failed to render template: {template_path}", details=str(e))
|
|
||||||
|
raise TemplateError(f"Failed to render template: {template_path}", details=str(e)) from e
|
||||||
|
|
||||||
create_file_with_content(file_path, content, success_message, should_format=should_format)
|
create_file_with_content(file_path, content, success_message, should_format=should_format)
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ This module provides functions to create Django projects and apps without requir
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from djinit.core.config import DJANGO_VERSION
|
from djinit.core.config import DJANGO_VERSION
|
||||||
from djinit.ui.console import UIFormatter
|
|
||||||
from djinit.utils.common import (
|
from djinit.utils.common import (
|
||||||
create_directory_with_init,
|
create_directory_with_init,
|
||||||
create_file_from_template,
|
create_file_from_template,
|
||||||
@@ -55,7 +54,8 @@ class DjangoHelper:
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
from djinit.utils.exceptions import DjinitError
|
from djinit.utils.exceptions import DjinitError
|
||||||
raise DjinitError(f"Error creating Django project: {e}", details=str(e))
|
|
||||||
|
raise DjinitError(f"Error creating Django project: {e}", details=str(e)) from e
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def startapp(app_name: str, directory: str) -> None:
|
def startapp(app_name: str, directory: str) -> None:
|
||||||
@@ -85,4 +85,5 @@ class DjangoHelper:
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
from djinit.utils.exceptions import DjinitError
|
from djinit.utils.exceptions import DjinitError
|
||||||
raise DjinitError(f"Error creating Django app: {e}", details=str(e))
|
|
||||||
|
raise DjinitError(f"Error creating Django app: {e}", details=str(e)) from e
|
||||||
@@ -14,14 +14,17 @@ class DjinitError(Exception):
|
|||||||
|
|
||||||
class ConfigError(DjinitError):
|
class ConfigError(DjinitError):
|
||||||
"""Raised when there is a configuration or metadata error."""
|
"""Raised when there is a configuration or metadata error."""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class FileError(DjinitError):
|
class FileError(DjinitError):
|
||||||
"""Raised when a file operation fails."""
|
"""Raised when a file operation fails."""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class TemplateError(DjinitError):
|
class TemplateError(DjinitError):
|
||||||
"""Raised when template rendering fails."""
|
"""Raised when template rendering fails."""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "djinitx"
|
name = "djinitx"
|
||||||
version = "0.2.1"
|
version = "0.3.0"
|
||||||
description = "A CLI tool to setup Django project"
|
description = "A CLI tool to setup Django project"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.13"
|
requires-python = ">=3.13"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from setuptools import find_packages, setup
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="djinitx",
|
name="djinitx",
|
||||||
version="0.2.1",
|
version="0.3.0",
|
||||||
description="A CLI tool to setup Django projects",
|
description="A CLI tool to setup Django projects",
|
||||||
long_description=open("README.md").read(),
|
long_description=open("README.md").read(),
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
|
|||||||
Reference in new issue
Block a user