Ruby Manager
A simple Ruby version manager written in Ruby. This tool helps you manage multiple Ruby versions by allowing you to install, uninstall, switch, and upgrade Ruby versions. It also ensures system dependencies are resolved automatically.
Features
- Install specific Ruby versions from the official Ruby source.
- Switch between installed Ruby versions.
- Uninstall unwanted Ruby versions.
- Upgrade to the latest available Ruby version.
.ruby-versionfile support for project-level Ruby management.- Automatic resolution of system dependencies.
- Logging of operations for debugging purposes.
- Shims for Ruby executables to ensure proper isolation.
Installation
-
Clone the repository or download the
ruby_manager.rbscript:git clone https://github.com/yourusername/ruby_manager cd ruby_manager -
Make the script executable:
-
Ensure Ruby is installed on your system.
-
Install system dependencies (if not already installed):
# On Debian/Ubuntu sudo apt-get update sudo apt-get install -y build-essential libssl-dev libreadline-dev zlib1g-dev libsqlite3-dev # On macOS xcode-select --install brew install openssl readline zlib sqlite3
Usage
Run the script using the following commands:
Install a Ruby Version
./ruby_manager.rb --install <version>
Example:
./ruby_manager.rb --install 3.2.0
List Installed Ruby Versions
Switch to a Specific Ruby Version
./ruby_manager.rb --switch <version>
Example:
./ruby_manager.rb --switch 3.2.0
Uninstall a Ruby Version
./ruby_manager.rb --uninstall <version>
Example:
./ruby_manager.rb --uninstall 3.1.0
Upgrade to the Latest Ruby Version
./ruby_manager.rb --upgrade
Update the Ruby Manager Script
./ruby_manager.rb --update-manager
Use .ruby-version File
Automatically switch to the Ruby version specified in the .ruby-version file:
./ruby_manager.rb --switch-to-version-file
Configuration
The Ruby Manager uses a configuration file located at ~/.myruby/config.yml. By default, it uses:
~/.myruby/versionsfor Ruby installations.~/.myruby/shimsfor executable shims.
You can edit the config.yml file to customize these paths.
Logging
Operations are logged in ~/.myruby/logs/manager.log. Check this file for debugging information.
Troubleshooting
Missing Dependencies
Ensure all required dependencies are installed. Run:
sudo apt-get install -y build-essential libssl-dev libreadline-dev zlib1g-dev
Gems Missing Native Extensions
Rebuild all installed gems with:
License
This project is licensed under the MIT License. See the LICENSE file for details.