A Ruby gem that safely refactors legacy code by recording, verifying, and comparing old and new implementations.
Suture is a Ruby gem that provides a safety net for refactoring or reimplementing legacy code. It helps developers change poorly-understood code by recording its behavior, verifying new implementations against those recordings, and offering fallback mechanisms in production. The tool supports the entire refactoring lifecycle from development to production deployment.
Ruby developers working with legacy codebases who need to refactor or rewrite untrustworthy code with confidence, particularly in teams maintaining large or complex applications.
Developers choose Suture because it reduces the risk of breaking changes by providing automated verification, staging environment safety checks, and production fallbacks, making refactoring predictable and less intimidating.
🏥 A Ruby gem that helps you refactor your legacy code
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports the entire lifecycle from local recording to production fallbacks, as detailed in the README's walk-through from development to staging and production.
Records legacy code behavior and verifies new implementations against those recordings, reducing manual test writing for untested code paths.
Offers fallback_on_error to revert to legacy code and custom error handlers, minimizing user disruption during risky deployments.
Includes built-in support for ActiveRecord objects with configurable attribute exclusion and allows custom comparators for complex return types.
Explicitly warns about side effects being difficult to handle and recommends minimizing them, which can restrict use for code with significant mutations or external dependencies.
Requires careful seam identification, environment variable management, and database setup for recordings, adding initial overhead compared to simpler refactoring approaches.
Recordings rely on specific database states or external services, making test reproducibility challenging without precise environment snapshots.