9 years ago started gemification of the Ruby standard library. What exactly are default and bundled gems in Ruby releases?
Ruby 3 preview1 announcement is mentioning the following update to default and bundled gems:
Promote default gems to bundled gems. - rexml - rss Promote stdlib to default gems. The following default gems were published on rubygems.org - abbrev - base64 - English - erb ...
These changes are part of a long-standing effort to gemify the Ruby standard library.
Here is the motivation (taken from the ticket):
== Motivation ruby's release cycle is slow for some standard libraries; ex. security fix for WEBrick, xmlrpc and Zlib. ex. API iteration for net/http, OpenSSL, json, psych, RDoc, minitest and rake. There's already the feature called 'default gems' in ruby and some stdlibs are already using it: rake, rdoc, minitest, json, io-console, bigdecimal And some gems are already doing out-of-band releases. When releasing we should give independence equally to all stdlibs, but in a consistent and controllable way.
Making all corners of the standard library being gems like any other 3rd-party library is quite nice and helps us move forward (it’s easier to abandon unused parts as gems and continue without them).
The question people might have when reading these Ruby announcements is, what are default and bundled gems exactly?
First, some parts of Ruby stdlib are not gems at all. They ship directly with Ruby, and you can require these libraries without declaring them. You cannot remove this part from Ruby.
The rest of the standard library is shipped as default gems. Default gems are Ruby stdlib libraries that were converted to gems. Similar to non-gemified part of stdlib, you cannot remove them. You can directly require them without declaring them as dependencies (in gemspecs and Gemfiles).
Bundled gems are regular gems that ship with the default Ruby installation. These libraries are maintained outside the Ruby core team and can be uninstalled if necessary. As with other 3rd-party gems, you have to include them into gemspec or gemfile.
Regular stdlib libraries might be removed or gemified, possibly ending as default and later as bundled gems. In the opposite direction, 3rd-party gems such as
did_you_mean can be promoted from bundled to default.
Note that you can still list these gems as dependencies to get newer versions from RubyGems. This is actually the whole point of this change.
Finally, you might wonder which parts are automatically required. Any library of these three kinds can be auto-required in Ruby, whether it’s a regular library, default, or bundled gem. The
did_you_mean gem is a good example of this. It was auto-required in older Rubies, but you could still uninstall it. From 2.6, the gem stayed on as a default.
You would be surprised how many changes in these gems happen every minor release. Luckily we have a dedicated site that keeps track!
← BUY THE PRE-RELEASE
I am writing a complete guide on web application deployment. Ruby with Puma, Python with Gunicorn, NGINX, PostgreSQL, Redis, networking, processes, systemd, backups, and all your usual suspects. 19 chapters and 2 case studies already available.