summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBundlerbot <bot@bundler.io>2019-11-07 09:57:38 +0000
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-11-07 16:41:45 +0100
commit6f27c477446b3ccaea9bd4472fd4d0b4b24aa427 (patch)
tree5d4a6ead4df669dc78e51b4c4592059010b3380c
parentb30656929da791c58afcdc50cfde24cff3b1ebee (diff)
downloadbundler-6f27c477446b3ccaea9bd4472fd4d0b4b24aa427.tar.gz
Merge #7417
7417: Fix bundler/inline warning: method redefined; discarding old root r=deivid-rodriguez a=fatkodima Closes #6167 Co-authored-by: fatkodima <fatkodima123@gmail.com> (cherry picked from commit a1ecdbffceded635d615fc31d4823a2a67a8db0d)
-rw-r--r--lib/bundler/inline.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/bundler/inline.rb b/lib/bundler/inline.rb
index 5491555d67..152d7d3f60 100644
--- a/lib/bundler/inline.rb
+++ b/lib/bundler/inline.rb
@@ -38,6 +38,8 @@ def gemfile(install = false, options = {}, &gemfile)
raise ArgumentError, "Unknown options: #{opts.keys.join(", ")}" unless opts.empty?
old_root = Bundler.method(:root)
+ bundler_module = class << Bundler; self; end
+ bundler_module.send(:remove_method, :root)
def Bundler.root
Bundler::SharedHelpers.pwd.expand_path
end
@@ -70,6 +72,8 @@ def gemfile(install = false, options = {}, &gemfile)
runtime.setup.require
end
ensure
- bundler_module = class << Bundler; self; end
- bundler_module.send(:define_method, :root, old_root) if old_root
+ if bundler_module
+ bundler_module.send(:remove_method, :root)
+ bundler_module.send(:define_method, :root, old_root)
+ end
end