luislavena/rake-compiler — pull request #76 by kou (2013-03-21 13:44:53+00:00)
Title: Re-support fat gem

Ruby 1.9 bundles RubyGems and it is required automatically before
command line "-r" option. It breaks fake.rb trick. We cannot build fat
gem without fake.rb trick because building fat gem requires two or
more Rubies and fake.rb fakes Rubies.

/tmp/rbconfig.rb:

p :rbconfig

puts caller

module RbConfig
Config = {}
end

/tmp/fake.rb:

p :fake

Command:

% cd /tmp
% ruby -v -I . -r fake -e ''
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
:rbconfig
/usr/lib/ruby/1.9.1/rubygems.rb:31:in `require'
/usr/lib/ruby/1.9.1/rubygems.rb:31:in `'
:1:in `require'
:1:in `'
:fake

The command output shows fake.rb that is used to change RUBY_PLATFORM,
RUBY_VERSION and so on in rake-compiler is required after
rbconfig.rb. And rbconfig.rb is required from RubyGems.

fake.rb should be required before rbconfig.rb because rbconfig.rb uses
RUBY_VERSION. So this change puts 'require "fake.rb"' into
rbconfig.rb. It ensures that fake.rb is evaluated before rbconfig.rb
body is evaluated.