mirror of
https://github.com/SuperClaude-Org/SuperClaude_Framework.git
synced 2025-12-29 16:16:08 +00:00
Fixed installer.py
Fixed Update issue added missing function update_components() to installer.py Signed-off-by: Mithun Gowda B <mithungowda.b7411@gmail.com>
This commit is contained in:
@@ -9,10 +9,13 @@ import tempfile
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from .component import Component
|
from .component import Component
|
||||||
|
|
||||||
|
|
||||||
class Installer:
|
class Installer:
|
||||||
"""Main installer orchestrator"""
|
"""Main installer orchestrator"""
|
||||||
|
|
||||||
def __init__(self, install_dir: Optional[Path] = None, dry_run: bool = False):
|
def __init__(self,
|
||||||
|
install_dir: Optional[Path] = None,
|
||||||
|
dry_run: bool = False):
|
||||||
"""
|
"""
|
||||||
Initialize installer
|
Initialize installer
|
||||||
|
|
||||||
@@ -25,6 +28,8 @@ class Installer:
|
|||||||
self.dry_run = dry_run
|
self.dry_run = dry_run
|
||||||
self.components: Dict[str, Component] = {}
|
self.components: Dict[str, Component] = {}
|
||||||
self.installed_components: Set[str] = set()
|
self.installed_components: Set[str] = set()
|
||||||
|
self.updated_components: Set[str] = set()
|
||||||
|
|
||||||
self.failed_components: Set[str] = set()
|
self.failed_components: Set[str] = set()
|
||||||
self.skipped_components: Set[str] = set()
|
self.skipped_components: Set[str] = set()
|
||||||
self.backup_path: Optional[Path] = None
|
self.backup_path: Optional[Path] = None
|
||||||
@@ -70,7 +75,8 @@ class Installer:
|
|||||||
return
|
return
|
||||||
|
|
||||||
if name in resolving:
|
if name in resolving:
|
||||||
raise ValueError(f"Circular dependency detected involving {name}")
|
raise ValueError(
|
||||||
|
f"Circular dependency detected involving {name}")
|
||||||
|
|
||||||
if name not in self.components:
|
if name not in self.components:
|
||||||
raise ValueError(f"Unknown component: {name}")
|
raise ValueError(f"Unknown component: {name}")
|
||||||
@@ -104,7 +110,9 @@ class Installer:
|
|||||||
stat = shutil.disk_usage(self.install_dir.parent)
|
stat = shutil.disk_usage(self.install_dir.parent)
|
||||||
free_mb = stat.free / (1024 * 1024)
|
free_mb = stat.free / (1024 * 1024)
|
||||||
if free_mb < 500:
|
if free_mb < 500:
|
||||||
errors.append(f"Insufficient disk space: {free_mb:.1f}MB free (500MB required)")
|
errors.append(
|
||||||
|
f"Insufficient disk space: {free_mb:.1f}MB free (500MB required)"
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
errors.append(f"Could not check disk space: {e}")
|
errors.append(f"Could not check disk space: {e}")
|
||||||
|
|
||||||
@@ -162,21 +170,20 @@ class Installer:
|
|||||||
|
|
||||||
# Create archive only if there are files to backup
|
# Create archive only if there are files to backup
|
||||||
if any(temp_backup.iterdir()):
|
if any(temp_backup.iterdir()):
|
||||||
shutil.make_archive(
|
shutil.make_archive(backup_path.with_suffix(''), 'gztar',
|
||||||
backup_path.with_suffix(''),
|
temp_dir, backup_name)
|
||||||
'gztar',
|
|
||||||
temp_dir,
|
|
||||||
backup_name
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
# Create empty backup file to indicate backup was attempted
|
# Create empty backup file to indicate backup was attempted
|
||||||
backup_path.touch()
|
backup_path.touch()
|
||||||
print(f"Warning: No files to backup, created empty backup marker: {backup_path.name}")
|
print(
|
||||||
|
f"Warning: No files to backup, created empty backup marker: {backup_path.name}"
|
||||||
|
)
|
||||||
|
|
||||||
self.backup_path = backup_path
|
self.backup_path = backup_path
|
||||||
return backup_path
|
return backup_path
|
||||||
|
|
||||||
def install_component(self, component_name: str, config: Dict[str, Any]) -> bool:
|
def install_component(self, component_name: str,
|
||||||
|
config: Dict[str, Any]) -> bool:
|
||||||
"""
|
"""
|
||||||
Install a single component
|
Install a single component
|
||||||
|
|
||||||
@@ -215,6 +222,7 @@ class Installer:
|
|||||||
|
|
||||||
if success:
|
if success:
|
||||||
self.installed_components.add(component_name)
|
self.installed_components.add(component_name)
|
||||||
|
self.updated_components.add(component_name)
|
||||||
else:
|
else:
|
||||||
self.failed_components.add(component_name)
|
self.failed_components.add(component_name)
|
||||||
|
|
||||||
@@ -225,7 +233,9 @@ class Installer:
|
|||||||
self.failed_components.add(component_name)
|
self.failed_components.add(component_name)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def install_components(self, component_names: List[str], config: Optional[Dict[str, Any]] = None) -> bool:
|
def install_components(self,
|
||||||
|
component_names: List[str],
|
||||||
|
config: Optional[Dict[str, Any]] = None) -> bool:
|
||||||
"""
|
"""
|
||||||
Install multiple components in dependency order
|
Install multiple components in dependency order
|
||||||
|
|
||||||
@@ -292,6 +302,10 @@ class Installer:
|
|||||||
print("\nAll components validated successfully!")
|
print("\nAll components validated successfully!")
|
||||||
else:
|
else:
|
||||||
print("\nSome components failed validation. Check errors above.")
|
print("\nSome components failed validation. Check errors above.")
|
||||||
|
def update_components(self, component_names: List[str], config: Dict[str, Any]) -> bool:
|
||||||
|
"""Alias for update operation (uses install logic)"""
|
||||||
|
return self.install_components(component_names, config)
|
||||||
|
|
||||||
|
|
||||||
def get_installation_summary(self) -> Dict[str, Any]:
|
def get_installation_summary(self) -> Dict[str, Any]:
|
||||||
"""
|
"""
|
||||||
@@ -308,3 +322,10 @@ class Installer:
|
|||||||
'install_dir': str(self.install_dir),
|
'install_dir': str(self.install_dir),
|
||||||
'dry_run': self.dry_run
|
'dry_run': self.dry_run
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def get_update_summary(self) -> Dict[str, Any]:
|
||||||
|
return {
|
||||||
|
'updated': list(self.updated_components),
|
||||||
|
'failed': list(self.failed_components),
|
||||||
|
'backup_path': str(self.backup_path) if self.backup_path else None
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user