Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Fix bundler/inline warning: method redefined; discarding old root #7417

Merged
1 commit merged into from Nov 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/bundler/inline.rb
Expand Up @@ -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
Expand Down Expand Up @@ -70,6 +72,8 @@ def definition.lock(*); end
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