Skip to content

Commit 75a354e

Browse files
committed
allow to boot Rails 2.3 "stub" app with RubyGems 2.x (for easier local testing)
1 parent bc019de commit 75a354e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/spec/stub/rails23/WEB-INF/config/environment.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,29 @@
66
# Bootstrap the Rails environment, frameworks, and default configuration
77
require File.join(File.dirname(__FILE__), 'boot')
88

9+
# Monkey-Patch for RubyGems < 2.0 (will ignore vendor gems)
10+
unless defined? Gem.source_index
11+
module Gem
12+
13+
def self.source_index
14+
sources
15+
end
16+
17+
def self.cache
18+
sources
19+
end
20+
21+
SourceIndex = Specification
22+
23+
class SourceList # only needed for vendor gems
24+
include Enumerable
25+
def search( *args ); []; end
26+
def each( &block ); end
27+
end
28+
29+
end
30+
end
31+
932
Rails::Initializer.run do |config|
1033
# Settings in config/environments/* take precedence over those specified here.
1134
# Application configuration should go into files in config/initializers

0 commit comments

Comments
 (0)