-
Notifications
You must be signed in to change notification settings - Fork 0
Implement Generate Functionality: fix ProjectWorker config structure, add CLAP support, cleanup, and test coverage #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
fe66fb4
09d902a
78cc51e
2da9c0d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -13,6 +13,8 @@ | |||||
| update_workflow_files, | ||||||
| ) | ||||||
|
|
||||||
| DEFAULT_TEMPLATE_URL = "https://github.com/SeamusMullan/PluginTemplate.git" | ||||||
|
|
||||||
|
|
||||||
| class ProjectWorker(QObject): | ||||||
| """Worker class that handles project generation in a separate thread""" | ||||||
|
|
@@ -61,21 +63,41 @@ def run(self): | |||||
| self.finished.emit() | ||||||
|
|
||||||
| except Exception as e: | ||||||
| self._cleanup_on_failure() | ||||||
| self.error.emit(f"Project generation failed: {e!s}") | ||||||
| self.finished.emit() | ||||||
|
|
||||||
| def _cleanup_on_failure(self) -> None: | ||||||
| """Remove a partially-created output directory after a generation failure.""" | ||||||
| output_dir = self.params.get("output_directory", "") | ||||||
| if output_dir and os.path.exists(output_dir): | ||||||
| try: | ||||||
| shutil.rmtree(output_dir, onerror=self.remove_readonly) | ||||||
| self.progress.emit("Cleaned up partial output directory") | ||||||
| except Exception: | ||||||
| pass | ||||||
|
|
||||||
| def clone_template_repo(self): | ||||||
| """Clone the template repository""" | ||||||
| output_dir = self.params.get("output_directory", "") | ||||||
| if not output_dir: | ||||||
| raise RuntimeError("Output directory is not specified") | ||||||
|
|
||||||
| if os.path.exists(output_dir): | ||||||
| raise RuntimeError(f"Output directory already exists: {output_dir}") | ||||||
|
|
||||||
| fork_url = self.params.get("fork_url", "") or DEFAULT_TEMPLATE_URL | ||||||
|
||||||
| fork_url = self.params.get("fork_url", "") or DEFAULT_TEMPLATE_URL | |
| fork_url = str(self.params.get("fork_url", "")).strip() or DEFAULT_TEMPLATE_URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_cleanup_on_failure()suppresses all exceptions duringshutil.rmtree(...)with a bareexcept Exception: pass. If cleanup fails (permissions, locked files, etc.) it will be silently ignored, leaving partial output behind with no visibility. Consider at least emitting a progress/error message (or logging) with the exception details so failures are diagnosable.