So of course we want to run our rails-2.3.17 apps on ruby-2.0, cos it’s faster
and damn the consequences. But there’s a problem with Gem.source_index:
rails-2.3.17/lib/rails/gem_dependency.rb:21:in `add_frozen_gem_path': undefined method `source_index' for Gem:Module (NoMethodError)
Fortunately a fix is relatively easy. This monkey-patch works in at least one
real 2.3.17 application, although it ignores vendor gems. It has not been tested
extensively and may cause your rails app to turn into a DSL for generating backtraces.
# Bootstrap the Rails environment, frameworks, and default configurationrequireFile.join(File.dirname(__FILE__),'boot')# monkey patch for 2.0. Will ignore vendor gems.ifRUBY_VERSION>="2.0.0"moduleGemdefself.source_indexsourcesenddefself.cachesourcesendSourceIndex=SpecificationclassSourceList# If you want vendor gems, this is where to start writing code.defsearch(*args);;enddefeach(&block);endincludeEnumerableendendendRails::Initializer.rundo|config|config.gem'haml'# etc# maybe some more# and so on...# Note that iconv is a gem in ruby-2.0config.gem'iconv'ifRUBY_VERSION>="2.0.0"# some other config stuff# and some more# and a little more...end