IronRuby: `gem update --system`

After reading this article on getting around the invalid exec_format “ir”, no %s issue when trying to update RubyGems in IronRuby, I came up with a better solution (rather than essentially swallowing the exception) to the problem. Stick the following file in: %IronRubyInstallDir%\lib\ruby\site_ruby\1.8\rubygems\defaults\ironruby.rb

module Gem
  def self.default_exec_format
    exec_format = ConfigMap[:ruby_install_name].sub('ir', '%s') rescue '%s'

    unless exec_format =~ /%s/ then
      raise Gem::Exception,
        "[BUG] invalid exec_format #{exec_format.inspect}, no %s"
    end

    exec_format
  end
end

I'm working on getting this contributed to the IronRuby project, as judging from the RubyGems sources, as well as the RubyGems sources distributed with JRuby, this is intended to be distributed by the Ruby implementation, not RubyGems itself.

Also note, this allows one to:

ir -S gem install bundler

Comments

comments powered by Disqus