summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2016-10-21 11:04:08 +0900
committerSamuel Giddins <segiddins@segiddins.me>2016-10-22 01:14:43 -0500
commit86bddc8c7189d3b2388853ff1e8c10187dd77bb7 (patch)
treed11bcfa89507300cf1866e466526fa56c3f0d6d9
parentaf6ac0a392966ca8a1d7a2924e4f834d7d5369d5 (diff)
downloadbundler-86bddc8c7189d3b2388853ff1e8c10187dd77bb7.tar.gz
Auto merge of #5106 - bundler:seg-public-gem, r=indirect
[RubygemsIntegration] Temporarily make #gem public again Closes #5102 \c @indirect @schneems (cherry picked from commit 90b99f2c35b38724fd7a9fef3e96587bd5aed2b4)
-rw-r--r--lib/bundler/rubygems_integration.rb4
-rw-r--r--spec/runtime/setup_spec.rb15
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 1c44ef3ddd..3f96c6ef7d 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -348,6 +348,10 @@ module Bundler
true
end
+
+ # TODO: delete this in 2.0, it's a backwards compatibility shim
+ # see https://github.com/bundler/bundler/issues/5102
+ kernel_class.send(:public, :gem)
end
end
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb
index eab66e2ee2..1251f25d80 100644
--- a/spec/runtime/setup_spec.rb
+++ b/spec/runtime/setup_spec.rb
@@ -1094,4 +1094,19 @@ describe "Bundler.setup" do
expect(post_bundler).to match(/\d+\.\d+\.\d+/)
end
end
+
+ describe "after setup" do
+ it "allows calling #gem on random objects" do
+ install_gemfile <<-G
+ source "file:#{gem_repo1}"
+ gem "rack"
+ G
+ ruby! <<-RUBY
+ require "bundler/setup"
+ Object.new.gem "rack"
+ puts Gem.loaded_specs["rack"].full_name
+ RUBY
+ expect(out).to eq("rack-1.0.0")
+ end
+ end
end