Date: 2025-02-23
Status
Accepted
Context
We have two main setup components:
- setup_tools.rb: Handles system-level tool installation and updates
- setup_project.rb: Manages book project initialization and configuration
We need consistent patterns between these components while respecting their different responsibilities.
Decision
We will implement the following architectural patterns:
-
Class Initialization
- setup_tools.rb: Simple initialization with OS validation
- setup_project.rb: Configuration-based initialization with dependency injection
- Both use single responsibility principle
-
Configuration Injection
- Explicit configuration objects for project setup
- Environment-specific settings passed via options hash
- Configuration validation at initialization time
-
Service Object Pattern
- Each major function split into dedicated service classes
- Clear separation between system tools and project setup
- Consistent interface patterns across services
-
Component Structure
- Managers for specific domains (HomebrewManager, MetadataManager, etc)
- Shared validation through System::Validator
- Common configuration handling
- Standardized logging approach
Consequences
Positive
- Clear separation of concerns between system and project setup
- Consistent error handling patterns
- Testable components through dependency injection
- Modular design allows for easy extension
Negative
- More complex initial setup required
- Need to maintain consistency between approaches
- Additional abstraction layers to manage
- Requires clear documentation of patterns