chore: update djinitx version to 0.2.1
This commit is contained in:
4 files changed
+32
-15
No files matched your search
@@ -344,7 +344,9 @@ class FileManager:
|
|||||||
]
|
]
|
||||||
for filename, template, context in project_files:
|
for filename, template, context in project_files:
|
||||||
filepath = os.path.join(project_dir, filename)
|
filepath = os.path.join(project_dir, filename)
|
||||||
create_file_from_template(filepath, template, context, f"Created {self.module_name}/{filename}", should_format=True)
|
create_file_from_template(
|
||||||
|
filepath, template, context, f"Created {self.module_name}/{filename}", should_format=True
|
||||||
|
)
|
||||||
|
|
||||||
# Create app component directories
|
# Create app component directories
|
||||||
components = ["admin", "api", "models", "routes", "serializers", "tests", "views"]
|
components = ["admin", "api", "models", "routes", "serializers", "tests", "views"]
|
||||||
@@ -357,7 +359,7 @@ class FileManager:
|
|||||||
os.path.join(project_dir, "admin", "__init__.py"),
|
os.path.join(project_dir, "admin", "__init__.py"),
|
||||||
"base/admin.j2",
|
"base/admin.j2",
|
||||||
{},
|
{},
|
||||||
f"Created {self.module_name}/admin/__init__.py"
|
f"Created {self.module_name}/admin/__init__.py",
|
||||||
)
|
)
|
||||||
|
|
||||||
# api
|
# api
|
||||||
@@ -365,7 +367,7 @@ class FileManager:
|
|||||||
os.path.join(project_dir, "api", "urls.py"),
|
os.path.join(project_dir, "api", "urls.py"),
|
||||||
"predefined/api/urls.j2",
|
"predefined/api/urls.j2",
|
||||||
{},
|
{},
|
||||||
f"Created {self.module_name}/api/urls.py"
|
f"Created {self.module_name}/api/urls.py",
|
||||||
)
|
)
|
||||||
|
|
||||||
# models
|
# models
|
||||||
@@ -373,7 +375,7 @@ class FileManager:
|
|||||||
os.path.join(project_dir, "models", "__init__.py"),
|
os.path.join(project_dir, "models", "__init__.py"),
|
||||||
"base/models.j2",
|
"base/models.j2",
|
||||||
{},
|
{},
|
||||||
f"Created {self.module_name}/models/__init__.py"
|
f"Created {self.module_name}/models/__init__.py",
|
||||||
)
|
)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ class ProjectMetadata:
|
|||||||
"nested_dir": self.nested_dir,
|
"nested_dir": self.nested_dir,
|
||||||
"use_database_url": self.use_database_url,
|
"use_database_url": self.use_database_url,
|
||||||
"predefined_structure": self.predefined_structure,
|
"predefined_structure": self.predefined_structure,
|
||||||
"predefined_structure": self.predefined_structure,
|
|
||||||
"unified_structure": self.unified_structure,
|
"unified_structure": self.unified_structure,
|
||||||
"single_structure": self.single_structure,
|
"single_structure": self.single_structure,
|
||||||
"project_module_name": self.project_module_name,
|
"project_module_name": self.project_module_name,
|
||||||
@@ -254,7 +253,12 @@ class InputCollector:
|
|||||||
return CharReader.get_yes_no(f"[{UIColors.HIGHLIGHT}]Use DATABASE_URL? (Y/n):[/{UIColors.HIGHLIGHT}]") == "y"
|
return CharReader.get_yes_no(f"[{UIColors.HIGHLIGHT}]Use DATABASE_URL? (Y/n):[/{UIColors.HIGHLIGHT}]") == "y"
|
||||||
|
|
||||||
def _get_structure_metadata(
|
def _get_structure_metadata(
|
||||||
self, project_dir: str, predefined: bool = False, unified: bool = False, single: bool = False, single_module_name: str = None
|
self,
|
||||||
|
project_dir: str,
|
||||||
|
predefined: bool = False,
|
||||||
|
unified: bool = False,
|
||||||
|
single: bool = False,
|
||||||
|
single_module_name: str = None,
|
||||||
) -> Tuple[str, str, list[str], dict]:
|
) -> Tuple[str, str, list[str], dict]:
|
||||||
"""Helper method to get metadata for predefined/unified structures."""
|
"""Helper method to get metadata for predefined/unified structures."""
|
||||||
project_name = project_dir
|
project_name = project_dir
|
||||||
@@ -492,16 +496,23 @@ def get_user_input() -> Tuple[str, str, str, list, dict]:
|
|||||||
if use_single:
|
if use_single:
|
||||||
console.print()
|
console.print()
|
||||||
console.print(f"[{UIColors.MUTED}]Common names: project, core, app[/{UIColors.MUTED}]")
|
console.print(f"[{UIColors.MUTED}]Common names: project, core, app[/{UIColors.MUTED}]")
|
||||||
single_module_name = collector.get_validated_input(
|
single_module_name = (
|
||||||
"Enter project configuration directory name (default: project)",
|
collector.get_validated_input(
|
||||||
validate_project_name,
|
"Enter project configuration directory name (default: project)",
|
||||||
"directory name",
|
validate_project_name,
|
||||||
allow_empty=True
|
"directory name",
|
||||||
) or "project"
|
allow_empty=True,
|
||||||
|
)
|
||||||
|
or "project"
|
||||||
|
)
|
||||||
console.print()
|
console.print()
|
||||||
|
|
||||||
project_name, primary_app, app_names, metadata_dict = collector._get_structure_metadata(
|
project_name, primary_app, app_names, metadata_dict = collector._get_structure_metadata(
|
||||||
project_dir, predefined=use_predefined, unified=use_unified, single=use_single, single_module_name=single_module_name
|
project_dir,
|
||||||
|
predefined=use_predefined,
|
||||||
|
unified=use_unified,
|
||||||
|
single=use_single,
|
||||||
|
single_module_name=single_module_name,
|
||||||
)
|
)
|
||||||
|
|
||||||
return project_dir, project_name, primary_app, app_names, metadata_dict
|
return project_dir, project_name, primary_app, app_names, metadata_dict
|
||||||
|
|||||||
@@ -114,7 +114,11 @@ class ProjectManager:
|
|||||||
apps_base_dir = self._get_apps_base_dir()
|
apps_base_dir = self._get_apps_base_dir()
|
||||||
|
|
||||||
# In predefined or unified structure, apps layout differs; skip strict per-app validation
|
# In predefined or unified structure, apps layout differs; skip strict per-app validation
|
||||||
if not self.metadata.get("predefined_structure") and not self.metadata.get("unified_structure") and not self.metadata.get("single_structure"):
|
if (
|
||||||
|
not self.metadata.get("predefined_structure")
|
||||||
|
and not self.metadata.get("unified_structure")
|
||||||
|
and not self.metadata.get("single_structure")
|
||||||
|
):
|
||||||
for app_name in self.app_names:
|
for app_name in self.app_names:
|
||||||
app_files = [
|
app_files = [
|
||||||
os.path.join(apps_base_dir, app_name, "__init__.py"),
|
os.path.join(apps_base_dir, app_name, "__init__.py"),
|
||||||
|
|||||||
Reference in new issue
Block a user