How ruby/rubygems works
RubyGems provides the gem command and runtime framework for creating, publishing, installing, managing, and loading Ruby packages. Its principal user workflow is to request a gem operation, resolve and retrieve package metadata or archives, install locally, and load the gem in a Ruby program. Bundler, developed in the same repository, adds an application-focused workflow: describe dependencies, resolve compatible versions, install them, record exact versions, and run the application in that environment. The README documents these capabilities; the sampled source illustrates command dispatch, compact-index access, and Bundler’s version switching, but does not expose every integration between subsystems.
Main entry points: cli.rb bundle CLI · command_manager.rb Command Dispatch · install_command.rb Install Command · definition.rb Dependency Definition
Components 24
RubyGems Commands
- gem CLI
lib/rubygems/gem_runner.rb - Command Dispatch
lib/rubygems/command_manager.rb - Install Command
lib/rubygems/commands/install_command.rb - Build Gem
lib/rubygems/commands/build_command.rb - Publish Gem
lib/rubygems/commands/push_command.rb
Gem Package Lifecycle
- Gem Package
lib/rubygems/package.rb - Gem Resolver
lib/rubygems/resolver.rb - Gem Installer
lib/rubygems/installer.rb - Remote Fetcher
lib/rubygems/remote_fetcher.rb - Compact Index
lib/rubygems/compact_index_client.rb - Installed Gems
lib/rubygems/specification.rb
Bundler Management
- bundle CLI
lib/bundler/cli.rb - Gemfile DSL
lib/bundler/dsl.rb - Dependency Definition
lib/bundler/definition.rb - Dependency Resolver
lib/bundler/resolver.rb - Bundle Fetcher
lib/bundler/fetcher.rb - Bundle Installer
lib/bundler/installer.rb - Lockfile
lib/bundler/lockfile_generator.rb
Ruby Runtime
- Bundle Runtime
lib/bundler/runtime.rb - Bundler Setup
lib/bundler/setup.rb - Bundler Version Switch
lib/bundler/self_manager.rb
Other components
- Developer
- Ruby Program
- RubyGems.org
Connections 25
- Developer → gem CLI: runs command
- gem CLI → Command Dispatch: dispatches
- Command Dispatch → Install Command: invokes
- Command Dispatch → Build Gem: invokes
- Command Dispatch → Publish Gem: invokes
- Build Gem → Gem Package: builds package
- Publish Gem → RubyGems.org: publishes package
- Install Command → Gem Resolver: resolves dependencies
- Install Command → Remote Fetcher: retrieves gems
- Remote Fetcher → RubyGems.org: requests metadata
- Compact Index → RubyGems.org: fetches index
- Install Command → Gem Installer: installs gems
- Gem Installer → Installed Gems: writes installed specs
- Developer → bundle CLI: runs bundle command
- bundle CLI → Gemfile DSL: evaluates dependencies
- bundle CLI → Dependency Definition: loads definition
- Dependency Definition → Dependency Resolver: resolves versions
- Dependency Definition → Bundle Fetcher: retrieves sources
- Bundle Fetcher → RubyGems.org: fetches gems
- bundle CLI → Bundle Installer: installs bundle
- Bundle Installer → Lockfile: records versions
- Ruby Program → Bundler Setup: loads environment
- Bundler Setup → Bundle Runtime: activates bundle
- bundle CLI → Bundler Version Switch: switches version
- Bundle Runtime → Installed Gems: uses installed gems