Module: Bundler::Interactive::PluginDependencies
- Defined in:
- lib/bundler/interactive/update_interactive.rb
Overview
When bundler-interactive runs as an installed Bundler plugin, its gem dependencies (tty-prompt/tty-reader and their transitive deps) are installed alongside this gem under the plugin root, but Bundler does not add them to the load path -- see the "to support plugin deps" note in Bundler::Plugin#load_plugin. This bridges that gap.
Class Method Summary collapse
-
.load!(anchor) ⇒ Object
Adds every sibling gem's lib directory to the load path so the plugin's dependency closure can be required.
Class Method Details
.load!(anchor) ⇒ Object
Adds every sibling gem's lib directory to the load path so the plugin's
dependency closure can be required. anchor is a directory inside this
gem (e.g. dir); its ancestor named "gems" is the plugin gem home,
whose children are this gem and its installed dependencies. Appends
(rather than prepends) so host application gems keep precedence.
18 19 20 21 22 23 24 25 |
# File 'lib/bundler/interactive/update_interactive.rb', line 18 def self.load!(anchor) gems_dir = File.('../../../..', anchor) return unless File.basename(gems_dir) == 'gems' Dir[File.join(gems_dir, '*', 'lib')].sort.each do |lib| $LOAD_PATH.push(lib) unless $LOAD_PATH.include?(lib) end end |