public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Search Repo:
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
Use 'Gem.clear_paths' instead of our 'Gem.refresh_all_caches!' monkey 
patch.
Hongli Lai (Phusion) (author)
Mon Mar 31 09:40:10 -0700 2008
commit  a60f262fe38beda161024ee14f4387b2c3c73bdf
tree    133c6ffeea5ab66df5d13f6d591d6075213ce6a6
parent  11a38e87f5e3de0ee2150472166f33f905b9e139
...
57
58
59
60
 
61
62
63
...
57
58
59
 
60
61
62
63
0
@@ -57,7 +57,7 @@ class Application
0
       # If this error was reported before, then the cache might be out of
0
       # date because the Rails version may have been installed now.
0
       # So we reload the RubyGems cache and try again.
0
- Gem.refresh_all_caches!
0
+ Gem.clear_paths
0
       found_version = Gem.cache.search('rails', gem_version_spec).map do |x|
0
         x.version.version
0
       end.sort.last
...
253
254
255
256
257
258
259
260
261
262
...
270
271
272
273
274
275
276
 
 
 
277
278
279
...
253
254
255
 
 
 
 
256
257
258
...
266
267
268
 
 
 
 
269
270
271
272
273
274
0
@@ -253,10 +253,6 @@ private
0
   end
0
 
0
   def handle_spawn_application(app_root, lower_privilege, lowest_user)
0
- if @refresh_gems_cache
0
- Gem.refresh_all_caches!
0
- @refresh_gems_cache = false
0
- end
0
     lower_privilege = lower_privilege == "true"
0
     @spawners_lock.synchronize do
0
       spawner = @spawners[app_root]
0
@@ -270,10 +266,9 @@ private
0
           if e.child_exception.is_a?(LoadError)
0
             # A source file failed to load, maybe because of a
0
             # missing gem. If that's the case then the sysadmin
0
- # will install probably the gem. So next time an app
0
- # is launched, we'll refresh the RubyGems cache so
0
- # that we can detect new gems.
0
- @refresh_gems_cache = true
0
+ # will install probably the gem. So we clear RubyGems's
0
+ # cache so that it can detect new gems.
0
+ Gem.clear_paths
0
           end
0
           return
0
         end
...
157
158
159
160
161
162
163
164
165
166
...
178
179
180
181
182
183
184
 
 
 
185
186
187
...
157
158
159
 
 
 
 
160
161
162
...
174
175
176
 
 
 
 
177
178
179
180
181
182
0
@@ -157,10 +157,6 @@ private
0
   def handle_spawn_application(app_root, lower_privilege, lowest_user)
0
     lower_privilege = lower_privilege == "true"
0
     app = nil
0
- if @refresh_gems_cache
0
- Gem.refresh_all_caches!
0
- @refresh_gems_cache = false
0
- end
0
     begin
0
       app = spawn_application(app_root, lower_privilege, lowest_user)
0
     rescue ArgumentError => e
0
@@ -178,10 +174,9 @@ private
0
        (e.child_exception.is_a?(UnknownError) && e.child_exception.real_class_name == "MissingSourceFile")
0
         # A source file failed to load, maybe because of a
0
         # missing gem. If that's the case then the sysadmin
0
- # will install probably the gem. So next time an app
0
- # is launched, we'll refresh the RubyGems cache so
0
- # that we can detect new gems.
0
- @refresh_gems_cache = true
0
+ # will install probably the gem. So we clear RubyGems's
0
+ # cache so that it can detect new gems.
0
+ Gem.clear_paths
0
         send_error_page(client, 'load_error', :error => e, :app_root => app_root)
0
       elsif e.child_exception.nil?
0
         send_error_page(client, 'app_exited_during_initialization', :error => e,
...
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
...
194
195
196
 
 
 
 
 
 
 
 
 
 
 
197
198
199
0
@@ -194,17 +194,6 @@ class IO
0
   end
0
 end
0
 
0
-module Gem
0
- # Refresh all RubyGems caches so that newly installed gems can be found.
0
- def self.refresh_all_caches!
0
- # Why doesn't RubyGems already provide an API for this?
0
- cache.refresh!
0
- MUTEX.synchronize do
0
- @searcher = nil
0
- end
0
- end
0
-end
0
-
0
 module GC
0
   if !respond_to?(:copy_on_write_friendly?)
0
     # Checks whether the current Ruby interpreter's garbage

Comments

    No one has commented yet.