RubyGems Navigation menu


Back to blog posts

Rubygems 2.0.0.preview2

The Rubygems team is proud to announce the availability of 2.0.0.preview2. This version has been merged into ruby 2.0.0-preview2 as well, in preperation for Rubygems 2.0.0 final to be included in ruby 2.0.0 final.

Breaking changes

There are a number of changes in 2.0.0 that may break code expecting deprecated features of Rubygems. Most major libraries that use the internal Rubygems APIs have been updated, but there are bound to be a number that have not.

  • Deprecated Gem.unresolved_deps in favor of Gem::Specification.unresolved_deps
  • Merged Gem::Builder into Gem::Package. Use instead of
  • Merged Gem::Format into Gem::Package. Use instead of Gem::Format.from_file_by_path
  • Moved Gem::OldFormat to Gem::Package::Old. Gem::Package will automatically detect old gems for you, so there is no need to refer to it.
  • Removed Gem::DocManager, replaced by Gem::RDoc and done_installing hook
  • Removed Gem::Package::TarInput in favor of Gem::Package
  • Removed Gem::Package::TarOutput in favor of Gem::Package
  • Removed Gem::RemoteFetcher#open_uri_or_path. (steveklabnik)
  • Removed Gem::SSL in favor of using OpenSSL directly
  • Removed Gem.loaded_path
  • Removed RSS generation from the gem indexer
  • Removed benchmark option from .gemrc
  • Removed broken YAML gemspec support in gem build
  • Removed support for Ruby 1.9.1
  • Removed many deprecated methods

Major enhancements

As is the point of most 2.0s, Rubygems continues a number of enhancements.

  • Improved support for default gems shipping with ruby 2.0.0+. The default gems now are properly loaded as more important that the standard library, which was the intent.
  • A gem can have arbitrary metadata through Gem::Specification#metadata. This feature allows users to embed their own data inside a gem easily and retrieve it. It’s possible to use this to store information about native packages needed, commit inforation, or any other structure data.
  • gem search now defaults to –remote and is anchored like gem list. Fixes #166
  • Added –document to replace –rdoc and –ri. Use –no-document to disable documentation, –document=rdoc to only generate rdoc.
  • Only ri-format documentation is generated by default with HTML being automatically generated by gem server. This will speed up install time.
  • Add gemdeps file support. A gemdeps format file is a Gemfile, Isolate, or gem.deps.rb file. This files contain information about which gems and versions are needed to run a particular application. Rubygems now has a subset of functionality provided by bundler builtin to provide easy usage of these files.
  • Add ability to install gems directly from a compatible gemdep file (Gemfile, Isolate, gem.deps.rb) gem install --file path
  • Add ability to load gem activation information from a gemdeps file (Gemfile, Isolate, gem.deps.rb). Set RUBYGEMS_GEMDEPS=path to have it loaded. Use - as the path to autodetect (current and parent directories are searched).

Minor enhancements

Additionally, there are innumerable small enhancements. Here is a nice sampling.

  • Added –only-executables option to gem pristine. Fixes #326
  • Added -I flag for ‘gem query’ to exclude installed items
  • Added Gem.install(name, version=default) for interactive sessions
  • Added Gem::FilePermissionError#directory
  • Added Gem::rubygems_version which is like Gem::ruby_version
  • Added RUBYGEMS_HOST documentation to gem env
  • Added a post_installs hook that runs after Gem::DependencyInstaller finishes installing a set of gems
  • Added a usage method for Gem::Commands::OwnerCommand. (ffmike)
  • Added an optional type parameter to Gem::Specification#doc_dir.
  • Added announcements url and clarified how to file tickets
  • Added guidance for how to use rdoc and ri in setup command. (jjb)
  • Attempting to install multiple gems with –version is now an error. You can specify per-gem versions like rake:0.9.5
  • Clarified Gem::CommandManager example code to avoid multi load problems. (baroquebobcat)
  • Corrupt or bad cached specs are now re-downloaded. (cookrn)
  • Extension build arguments are saved from install and reused for pristine
  • If the OS allows it, documentation is built in a forked background process. (alexch)
  • Imported gem yank from the gemcutter gem. Fixes #177, #343
  • Packaged gems now contain and verify SHA1 checksums
  • Removed commas from gem update summary so you can paste it back to cleanup. (amatsuda)
  • RubyGems will now warn when building gems with prerelease dependencies. Fixes #255
  • The RUBYGEMS_HOST environment variable is used to determine appropriate API key for pushing or yanking gems
  • Uninstall is now performed in reverse topological order.
  • Users are told what to type when they try to uninstall a gem outside GEM_HOME
  • When building gems with non-world-readable files a warning is shown.

Bug fixes

And lastly, lots and lots of bugfixes. Here is a short memoriam of those bugs we’ve lost this release.

  • Added PID to setup bin_file while installing RubyGems to protect against errors. Fixes #328 by ConradIrwin
  • Added missing require in Gem::Uninstaller when format_executable is set. (sakuro)
  • Exact gem command name matches are now chosen even if a longer command overlaps the exact name
  • Fixed Gem.loaded_path? with a Pathname instance. (mattetti)
  • Fixed mismatch with checks
  • Fixed SecurityError in Gem::Specification.load when $SAFE=1. (ged)
  • Fixed SystemStackError with “gem list -r -a” on 1.9 (cldwalker)
  • Fixed gem owners command so that exceptions don’t stop the rest of the command from completing
  • Fixed gem unpack uninstalled\_gem default version picker.
  • Fixed defunct rubyforge urls in gem command line help
  • Fixed documentation for the various hooks collections
  • Fixed documentation generation on setup when the gem directory does not exist. Fixes #253
  • Fixed documentation to reflect where defaults overrides are loaded from. (ferrous26)
  • Fixed editing of a Makefile with 8-bit characters. Fixes #181
  • Fixed gem loading issue caused by dependencies not resolving.
  • Fixed independent testing of test_gem_package_tar_output. Ruby Bug #4686 by Shota Fukumori
  • Fixed typo in uninstall message. (sandal)
  • Gem::Requirement#<=> returns nil on non-requirement arg.
  • Gem::Requirement.satisfied_by? raises ArgumentError if given a non-version argument
  • Gem::Version#initialize no longer modifies its parameter. (miaout17)
  • Group-writable permissions are now allowed for gem repositories. (ctcherry)
  • Memoized values in Gem::Specification are now reset the version or platform changes. Fixes #78
  • More specific errors are raised for bad requirements. (arsduo)
  • Removed reference to ‘sources’ gem in documentation
  • Removed unused block arguments to avoid creating Proc objects. (k-tsj)
  • RubyGems now asks before overwriting executable wrappers. Ruby Bug #1800
  • The bindir is now created with mkdir_p during install. (voxik)
  • URI scheme matching is no longer case-sensitive. Fixes #322
  • ext/builder now checks $MAKE as well as $make (okkez)