End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
Gem.use_gemdeps
# File tmp/rubies/ruby-3.2.0/lib/rubygems.rb, line 1075
def self.use_gemdeps(path = nil)
raise_exception = path
path ||= ENV["RUBYGEMS_GEMDEPS"]
return unless path
path = path.dup
if path == "-"
Gem::Util.traverse_parents Dir.pwd do |directory|
dep_file = GEM_DEP_FILES.find {|f| File.file?(f) }
next unless dep_file
path = File.join directory, dep_file
break
end
end
path.tap(&Gem::UNTAINT)
unless File.file? path
return unless raise_exception
raise ArgumentError, "Unable to find gem dependencies file at #{path}"
end
ENV["BUNDLE_GEMFILE"] ||= File.expand_path(path)
require_relative "rubygems/user_interaction"
require "bundler"
begin
Gem::DefaultUserInteraction.use_ui(ui) do
begin
Bundler.ui.silence do
@gemdeps = Bundler.setup
end
ensure
Gem::DefaultUserInteraction.ui.close
end
end
rescue Bundler::BundlerError => e
warn e.message
warn "You may need to `bundle install` to install missing gems"
warn ""
end
end
Looks for a gem dependency file at path and activates the gems in the file if found. If the file is not found an ArgumentError is raised.
If path is not given the RUBYGEMS_GEMDEPS environment variable is used, but if no file is found no exception is raised.
If ‘-’ is given for path RubyGems searches up from the current working directory for gem dependency files (gem.deps.rb, Gemfile, Isolate) and activates the gems in the first one found.
You can run this automatically when rubygems starts. To enable, set the RUBYGEMS_GEMDEPS environment variable to either the path of your gem dependencies file or “-” to auto-discover in parent directories.
NOTE: Enabling automatic discovery on multiuser systems can lead to execution of arbitrary code when used from directories outside your control.