From Fedora Project Wiki


Ruby 2.5

Summary

Ruby 2.5 is the latest stable version of Ruby. Many new features and improvements are included for the increasingly diverse and expanding demands for Ruby. With this major update from Ruby 2.4 in Fedora 26 to Ruby 2.5 in Fedora 28, Fedora becomes the superior Ruby development platform.

Owner

Current status

Detailed Description

Ruby 2.5 is upstream's new major release of Ruby. Many new features and improvements are included.

New Features

  • rescue/else/ensure are now allowed to be used directly with do/end blocks.
  • Add yield_self to yield given block in its context. Unlike tap, it returns the result of the block.
  • Support branch coverage and method coverage measurement. The branch coverage indicates which branches are executed and which are not. The method coverage indicates which methods are invoked and which are not. By running a test suite with these new features, you will know which branches and methods are executed, and evaluate total coverage of the test suite more strictly.
  • Hash#slice [Feature #8499] and Hash#transform_keys.
  • Struct.new can create classes that accept keyword arguments.
  • Enumerable#any?, all?, none?, and one? accept a pattern argument.
  • Top-level constant look-up is no longer available.
  • One of our most loved libraries, pp.rb, is now automatically loaded. You no longer have to write require "pp".
  • Print backtrace and error message in reverse order (oldest call first, most recent call last). When a long backtrace appears on your terminal (TTY), you can easily find the cause line at the bottom of the backtrace. Note that the order is reversed only when the backtrace is printed out to the terminal directly.

Performance improvements

  • About 5-10% performance improvement by removing all trace instructions from overall bytecode (instruction sequences). The trace instruction was added to support the TracePoint. However, in most cases, TracePoint is not used and trace instructions are pure overhead. Instead, now we use a dynamic instrumentation technique.
  • Block passing by a block parameter (e.g. def foo(&b); bar(&b); end) is about 3 times faster than Ruby 2.4 by “Lazy Proc allocation” technique.
  • Mutex is rewritten to be smaller and faster.
  • ERB now generates code from a template twice as fast as Ruby 2.4.
  • Improve performance of some built-in methods including Array#concat, Enumerable#sort_by, String#concat, String#index, Time#+, and more.
  • IO.copy_stream uses copy_file_range(2) to copy offload.

Other notable changes since 2.4

  • SecureRandom now prefers OS-provided sources over OpenSSL.
  • Promote cmath, csv, date, dbm, etc, fcntl, fiddle, fileutils, gdbm, ipaddr, scanf, sdbm, stringio, strscan, webrick, zlib from standard libraries to default gems.
  • Update to Onigmo 6.1.3.
    • It adds the absence operator.
    • Note that Ruby 2.4.1 also includes this change.
  • Update to Psych 3.0.2.
  • Update to RubyGems 2.7.3.
  • Update to RDoc 6.0.1.
    • Switch the lexer from IRB based one to Ripper. This dramatically improves the performance of document generation.
    • Fix a significant amount of bugs that existed over ten years.
    • Add support for new Ruby syntax from the latest versions.
  • Update supported Unicode version to 10.0.0.
  • Thread.report_on_exception is now set to true by default. This change helps debugging of multi-threaded programs.
  • IO#write now receives multiple arguments.

Benefit to Fedora

With a latest release, Ruby language is supporting the newest language features, which enables even faster and easier development of Ruby applications.

Scope

  • Proposal owners:
    • Finish packaging of Ruby 2.5. Current changes available in private-ruby-2.5 branch of ruby package in dist-git.
    • Rebuilding of Ruby packages providing native extensions (i.e. packages which depends on libruby).


  • Other developers:
    • Rebuild of packages with binary extensions (i.e. packages which depends on libruby) will be handled automatically, but some packages might need fixes/updates to support Ruby 2.5 properly.
  • Release engineering: #7142
    • Separate Koji tag for package rebuild will be needed.
    • List of deliverables: N/A (not needed for this Change)
  • Policies and guidelines: N/A (not needed for this Change)
  • Trademark approval: N/A (not needed for this Change)

Upgrade/compatibility impact

  • User specific Ruby binary extensions need to be rebuild.

How To Test

  • No special hardware is needed.
  • To test, install Ruby 2.5. The test builds are pusblished on Ruby-SIG ML
  • Try to locally rebuild your packages using Ruby 2.5.
  • Use the packages with your applications previously written in Ruby.
  • If something doesn't work as it should, let us know.

User Experience

The Ruby programs/scripts should behave as they were used to.

Dependencies

$ dnf repoquery --disablerepo=* --enablerepo=rawhide --enablerepo=rawhide-source --arch=src --whatrequires 'ruby-devel' | sort | uniq | wc -l
159


Contingency Plan

  • Contingency mechanism: We would like to get a special buildroot tag to be able to rebuild necessary the packages with Ruby 2.5. If anything goes wrong, the tag could be easily dropped and previous version of Ruby 2.4 and its dependencies stays intact. The tag would be merged into F28 after everything is rebuild.
  • Contingency deadline: Mass Rebuild
  • Blocks release? No
  • Blocks product? No

Documentation

Release Notes

  • The Ruby 2.5 bumps soname, therefore Ruby packages, which use binary extensions, should be rebuilt. Nevertheless, since upstream paid great attention to source compatibility, no changes to your code are needed.

https://github.com/ruby/ruby/blob/trunk/NEWS