Skip to content

Commit

Permalink
Perform partial updates when uploading gems.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlea committed Jan 13, 2012
1 parent 369825c commit 512d9aa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Gemfile.lock
Expand Up @@ -14,9 +14,9 @@ GEM
rack
rake (0.9.2)
sinatra (1.3.1)
rack (>= 1.3.4, ~> 1.3)
rack-protection (>= 1.1.2, ~> 1.1)
tilt (>= 1.3.3, ~> 1.3)
rack (~> 1.3, >= 1.3.4)
rack-protection (~> 1.1, >= 1.1.2)
tilt (~> 1.3, >= 1.3.3)
tilt (1.3.3)

PLATFORMS
Expand Down
13 changes: 9 additions & 4 deletions lib/geminabox.rb
Expand Up @@ -49,13 +49,13 @@ def fixup_bundler_rubygems!
end

get '/reindex' do
reindex
reindex(:force_rebuild)
redirect url("/")
end

delete '/gems/*.gem' do
File.delete file_path if File.exists? file_path
reindex
reindex(:force_rebuild)
redirect url("/")
end

Expand Down Expand Up @@ -108,9 +108,14 @@ def error_response(code, message)
[code, html]
end

def reindex
def reindex(force_rebuild = false)
Geminabox.fixup_bundler_rubygems!
indexer.generate_index
force_rebuild = true if settings.build_legacy
if force_rebuild
indexer.generate_index
else
indexer.update_index
end
end

def indexer
Expand Down

0 comments on commit 512d9aa

Please sign in to comment.