Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allows serving of gems in the "gems" directory

If a "gems" directory exists, sinatra-rubygems will now serve gems
installed there (via "gem install -i") rather than system gems.  This
can be useful when running a gem server, as it allows one to serve gems
which are not installed on the system (and vice versa).
  • Loading branch information...
commit de6139b0ff61c7d3429a75dc8c97e4dfad514c84 1 parent e68f107
Greg Campbell authored
Showing with 4 additions and 4 deletions.
  1. +2 −2 config.ru
  2. +2 −2 lib/rack_rubygems.rb
4 config.ru
View
@@ -1,6 +1,6 @@
LIB_PATH = File.expand_path(File.join(File.dirname(__FILE__), 'lib'))
$:.unshift LIB_PATH
require 'rack_rubygems'
-use GemsAndRdocs, :urls => ['/cache', '/doc'], :root => Gem.dir
+use GemsAndRdocs, :urls => ['/cache', '/doc'], :root => File.directory?("gems") ? "gems" : Gem.dir
use Rack::Compress
-run RackRubygems.new
+run RackRubygems.new
4 lib/rack_rubygems.rb
View
@@ -104,7 +104,7 @@ class RackRubygems < Sinatra::Base
end
def source_index
- @gem_dir = Gem.dir
+ @gem_dir = File.directory?("gems") ? "gems" : Gem.dir
@spec_dir = File.join @gem_dir, 'specifications'
@source_index = Gem::SourceIndex.from_gems_in @spec_dir
response['Date'] = File.stat(@spec_dir).mtime.to_s
@@ -227,4 +227,4 @@ def yaml
source_index.to_yaml
end
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.