Skip to content

Commit

Permalink
Only fixup bundler when needed, and only once.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlea committed Sep 27, 2011
1 parent 143b2a7 commit 51d7073
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/geminabox.rb
Expand Up @@ -7,7 +7,6 @@

require 'hostess'


class Geminabox < Sinatra::Base
enable :static, :methodoverride

Expand All @@ -21,6 +20,12 @@ class << self
def disallow_replace?
! allow_replace
end

def fixup_bundler_rubygems!
return if @post_reset_hook_applied
Gem.post_reset{ Gem::Specification.all = nil } if defined? Bundler and Gem.respond_to? :post_reset
@post_reset_hook_applied = true
end
end

autoload :GemVersionCollection, "geminabox/gem_version_collection"
Expand Down Expand Up @@ -96,7 +101,7 @@ def error_response(code, message)
end

def reindex
Gem.post_reset{ Gem::Specification.all = nil }
Geminabox.fixup_bundler_rubygems!
Gem::Indexer.new(options.data).generate_index
end

Expand Down

0 comments on commit 51d7073

Please sign in to comment.