class Rake::ExtensionTask
def fake_rb(platform, version)
def fake_rb(platform, version) <<-FAKE_RB # Pre-load resolver library before faking, in order to avoid error # "cannot load such file -- win32/resolv" when it is required later on. # See also: https://github.com/tjschuck/rake-compiler-dev-box/issues/5 require 'resolv' require 'rbconfig' class Object remove_const :RbConfig remove_const :RUBY_PLATFORM remove_const :RUBY_VERSION remove_const :RUBY_DESCRIPTION if defined?(RUBY_DESCRIPTION) RUBY_PLATFORM = "#{platform}" RUBY_VERSION = "#{version}" RUBY_DESCRIPTION = "ruby \#{RUBY_VERSION} (\#{RUBY_RELEASE_DATE}) [\#{RUBY_PLATFORM}]" end if RUBY_PLATFORM =~ /mswin|bccwin|mingw/ class File remove_const :ALT_SEPARATOR ALT_SEPARATOR = "\\\\" end end posthook = proc do $ruby = "#{Gem.ruby}" untrace_var(:$ruby, posthook) end trace_var(:$ruby, posthook) _RB end