Ruby Reforge
🚀 Automatically upgrade Ruby projects to newer versions and fix deprecated code.
Overview
ruby-reforge is a gem that scans a Ruby or Rails project, detects incompatible code for a target Ruby version (e.g., upgrading from 3.1 → 3.3), and automatically rewrites or suggests fixes.
Features
- ✅ Updates
.ruby-version,Gemfile, andgemspecfiles - ✅ Fixes deprecated Ruby syntax automatically
- ✅ Detects and fixes removed features
- ✅ Rewrites code for new Ruby syntax
- ✅ Generates detailed upgrade reports
- ✅ Interactive mode for reviewing changes
- ✅ Git integration (creates branches, commits changes)
Installation
gem install ruby-reforgeOr add it to your Gemfile:
gem 'ruby-reforge', group: :developmentUsage
Upgrade to a new Ruby version
ruby-reforge upgrade 3.3This will:
- Update version files (
.ruby-version,Gemfile,gemspec) - Scan your codebase for deprecated patterns
- Automatically fix issues
- Create a git branch and commit changes
Generate a report
ruby-reforge reportShows what needs to be fixed without making changes.
Interactive mode
ruby-reforge upgrade 3.3 --interactivePrompts before making each change.
Dry run
ruby-reforge upgrade 3.3 --dry-runShows what would be changed without making any changes.
What It Fixes
Deprecated Methods
-
File.exists?→File.exist? -
Dir.exists?→Dir.exist? -
URI.escape→CGI.escape - And more...
Version Files
- Updates
.ruby-version - Updates
Gemfileruby version - Updates
gemspecrequired_ruby_version
Ruby 3.0+ Keyword Arguments
Detects and suggests fixes for keyword argument changes.
Examples
# Upgrade to Ruby 3.3
ruby-reforge upgrade 3.3
# Generate report for Ruby 3.2
ruby-reforge report --target 3.2
# Interactive upgrade
ruby-reforge upgrade 3.3 --interactiveRoadmap
- Rails-specific deprecations
- Gem dependency compatibility checker
- AI-assisted fixes for complex code
- Test framework updates
- Performance improvement suggestions
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
The gem is available as open source under the terms of the MIT License.