This guide explains how to use the consolidated Makefile and script structure for OpenDocMan development and testing.
The Makefile has been reorganized to serve as the single source of truth for all development tasks. Shell scripts have been moved to the scripts/ directory and are integrated through the Makefile.
# Complete setup
make setup
# Run all tests
make test
# Start services
make up
# View all available commands
make helpopendocman/
├── Makefile # Main task runner (source of truth)
├── scripts/ # Shell scripts (organized by functionality)
│ ├── run-tests.sh # Comprehensive test runner
│ ├── run-coverage.sh # Code coverage reporting
│ ├── run-user-tests.sh # User-specific tests
│ ├── run-department-tests.sh # Department-specific tests
│ ├── generate-env-secrets.sh # Environment setup
│ └── validate-env.sh # Environment validation
└── ...
make env-generate- Generate secure .env filemake env-validate- Validate .env configurationmake setup- Complete setup (generate + validate + start)
make up- Start servicesmake down- Stop servicesmake build- Build Docker imagesmake restart- Restart all servicesmake status- Show service statusmake logs- View all logs
make test- Run all testsmake test-unit- Run unit tests onlymake test-integration- Run integration tests onlymake test-user- Run all user-related testsmake test-department- Run all department-related testsmake test-class CLASS=ClassName- Run tests for specific classmake test-file FILE=TestFile- Run specific test filemake test-list- List available test filesmake test-quiet- Run tests with minimal outputmake test-watch- Watch files and auto-run testsmake test-install- Install test dependencies
make coverage- Generate text coverage reportmake coverage-html- Generate HTML coverage reportmake coverage-xml- Generate XML coverage reportmake coverage-all- Generate all coverage formats
make dev- Start in development modemake shell- Open shell in app containermake shell-db- Open MySQL shell
make clean- Remove containers and volumesmake rebuild- Rebuild everythingmake backup- Create backupmake security-scan- Run security scan
# Run all tests
make test
# Run only unit tests
make test-unit
# Run integration tests
make test-integration# Test user functionality
make test-user
# Test department functionality
make test-department# Test specific class
make test-class CLASS=User
# Test specific file
make test-file FILE=CategoryTest
# List available tests
make test-list# Quick text coverage
make coverage
# HTML report for detailed viewing
make coverage-html
# XML report for CI/CD
make coverage-xml
# All formats
make coverage-all# Watch for file changes and auto-run tests
make test-watch
# Run tests quietly (minimal output)
make test-quiet./run-tests.sh unit
./run-coverage.sh html
./run-user-tests.sh
./generate-env-secrets.shmake test-unit
make coverage-html
make test-user
make env-generate# Test specific class
make test-class CLASS=User
# Test specific file
make test-file FILE=CategoryTest
# Restore from backup
make restore-db BACKUP_FILE=backups/db_20241201_120000.sql# Set custom project name
COMPOSE_PROJECT_NAME=my-odm make up
# Use different environment
ODM_ENV=dev make upIf you need to use scripts directly with advanced options:
# Advanced test runner options
./scripts/run-tests.sh help
# Coverage script options
./scripts/run-coverage.sh help
# View script help through Makefile
make scripts-help- Single Source of Truth: All tasks go through the Makefile
- Organized Scripts: Scripts are in a dedicated directory
- Consistent Interface: All commands follow
make <action>pattern - Better Documentation: Help system shows all available commands
- Easier Discovery:
make helpshows everything you can do - Clean Root Directory: Fewer files in the project root
If make test fails but ./scripts/run-tests.sh works:
- Check that scripts are executable:
chmod +x scripts/*.sh - Verify scripts work from project root
- Check for path issues in script directories
- Makefile test commands run tests natively (faster)
- Docker test commands are available but may have TTY issues
- Use native testing for development, Docker for CI/CD
- Requires Xdebug for coverage reports
- Install with:
sudo apt install php8.2-xdebug - Coverage reports are generated in temporary directories by default
- Use Makefile commands instead of calling scripts directly
- Start with
make helpto see all available commands - Use
make setupfor initial project setup - Use
make testfor comprehensive testing - Use
make coverage-htmlfor detailed coverage analysis - Keep scripts in the
scripts/directory for organization
The Makefile structure is designed to be extensible. Future additions might include:
- Linting commands (
make lint) - Documentation generation (
make docs) - Deployment commands (
make deploy) - Database migration commands (
make migrate)
For more help, run make help or make scripts-help to see all available commands and their descriptions.