summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2009-07-28 20:44:45 -0700
committerCarl Lerche <carllerche@mac.com>2009-07-28 20:44:45 -0700
commit66bad10dc41e0a868145b1d7d4409e283b39ab5c (patch)
tree3a718fb70d6f6865a3733511c3d1a8254a9ffcfa
parenta585023c9ff2c86d063221502910a750b4469d7f (diff)
downloadbundler-66bad10dc41e0a868145b1d7d4409e283b39ab5c.tar.gz
Add bundled gems to Gem.source_index to work around a rubygems bug
-rw-r--r--lib/bundler/templates/environment.rb1
-rw-r--r--spec/bundler/cli_spec.rb7
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/bundler/templates/environment.rb b/lib/bundler/templates/environment.rb
index 7d974bc539..5a7e095795 100644
--- a/lib/bundler/templates/environment.rb
+++ b/lib/bundler/templates/environment.rb
@@ -2,6 +2,7 @@ module Bundler
def self.rubygems_required
<% spec_files.each do |name, path| %>
Gem.loaded_specs["<%= name %>"] = eval(File.read("<%= path %>"))
+ Gem.source_index.add_spec(Gem.loaded_specs["<%= name %>"])
<% end %>
end
end
diff --git a/spec/bundler/cli_spec.rb b/spec/bundler/cli_spec.rb
index 3930672a35..52d8efb97e 100644
--- a/spec/bundler/cli_spec.rb
+++ b/spec/bundler/cli_spec.rb
@@ -157,6 +157,7 @@ end
source "file://#{gem_repo1}"
gem "rake"
gem "extlib"
+ gem "very-simple"
gem "rack", :only => :web
require_rubygems
@@ -179,5 +180,11 @@ end
out = run_in_context "puts Gem.respond_to?(:sources)"
out.should =~ /true/
end
+
+ # TODO: Remove this when rubygems is fixed
+ it "adds the gem to Gem.source_index" do
+ out = run_in_context "puts Gem.source_index.find_name('very-simple').first.version"
+ out.should == "1.0\n"
+ end
end
end