Skip to content

Commit

Permalink
[rubygems/rubygems] Remove more methods now defined in all RubyGems v…
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez authored and hsbt committed Dec 14, 2023
1 parent 7564038 commit 5cf6f7f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 41 deletions.
2 changes: 1 addition & 1 deletion lib/bundler/fetcher.rb
Expand Up @@ -113,7 +113,7 @@ def fetch_spec(spec)

uri = Bundler::URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
spec = if uri.scheme == "file"
path = Bundler.rubygems.correct_for_windows_path(uri.path)
path = Gem::Util.correct_for_windows_path(uri.path)
Bundler.safe_load_marshal Bundler.rubygems.inflate(Gem.read_binary(path))
elsif cached_spec_path = gemspec_cached_path(spec_file_name)
Bundler.load_gemspec(cached_spec_path)
Expand Down
6 changes: 3 additions & 3 deletions lib/bundler/installer.rb
Expand Up @@ -214,7 +214,7 @@ def installation_parallelization(options)
end

def load_plugins
Bundler.rubygems.load_plugins
Gem.load_plugins

requested_path_gems = @definition.requested_specs.select {|s| s.source.is_a?(Source::Path) }
path_plugin_files = requested_path_gems.map do |spec|
Expand All @@ -223,8 +223,8 @@ def load_plugins
error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
raise Gem::InvalidSpecificationException, error_message
end.flatten
Bundler.rubygems.load_plugin_files(path_plugin_files)
Bundler.rubygems.load_env_plugins
Gem.load_plugin_files(path_plugin_files)
Gem.load_env_plugins
end

def ensure_specs_are_compatible!
Expand Down
4 changes: 2 additions & 2 deletions lib/bundler/plugin.rb
Expand Up @@ -307,7 +307,7 @@ def register_plugin(name, spec, optional_plugin = false)
@hooks_by_event = Hash.new {|h, k| h[k] = [] }

load_paths = spec.load_paths
Bundler.rubygems.add_to_load_path(load_paths)
Gem.add_to_load_path(*load_paths)
path = Pathname.new spec.full_gem_path

begin
Expand Down Expand Up @@ -342,7 +342,7 @@ def load_plugin(name)
# done to avoid conflicts
path = index.plugin_path(name)

Bundler.rubygems.add_to_load_path(index.load_paths(name))
Gem.add_to_load_path(*index.load_paths(name))

load path.join(PLUGIN_FILE_NAME)

Expand Down
34 changes: 0 additions & 34 deletions lib/bundler/rubygems_integration.rb
Expand Up @@ -43,18 +43,6 @@ def loaded_specs(name)
Gem.loaded_specs[name]
end

def add_to_load_path(paths)
return Gem.add_to_load_path(*paths) if Gem.respond_to?(:add_to_load_path)

if insert_index = Gem.load_path_insert_index
# Gem directories must come after -I and ENV['RUBYLIB']
$LOAD_PATH.insert(insert_index, *paths)
else
# We are probably testing in core, -I and RUBYLIB don't apply
$LOAD_PATH.unshift(*paths)
end
end

def mark_loaded(spec)
if spec.respond_to?(:activated=)
current = Gem.loaded_specs[spec.name]
Expand Down Expand Up @@ -116,16 +104,6 @@ def inflate(obj)
Gem::Util.inflate(obj)
end

def correct_for_windows_path(path)
if Gem::Util.respond_to?(:correct_for_windows_path)
Gem::Util.correct_for_windows_path(path)
elsif path[0].chr == "/" && path[1].chr =~ /[a-z]/i && path[2].chr == ":"
path[1..-1]
else
path
end
end

def gem_dir
Gem.dir
end
Expand Down Expand Up @@ -183,18 +161,6 @@ def loaded_gem_paths
loaded_gem_paths.flatten
end

def load_plugins
Gem.load_plugins if Gem.respond_to?(:load_plugins)
end

def load_plugin_files(files)
Gem.load_plugin_files(files) if Gem.respond_to?(:load_plugin_files)
end

def load_env_plugins
Gem.load_env_plugins if Gem.respond_to?(:load_env_plugins)
end

def ui=(obj)
Gem::DefaultUserInteraction.ui = obj
end
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/runtime.rb
Expand Up @@ -28,7 +28,7 @@ def setup(*groups)
spec.load_paths.reject {|path| $LOAD_PATH.include?(path) }
end.reverse.flatten

Bundler.rubygems.add_to_load_path(load_paths)
Gem.add_to_load_path(*load_paths)

setup_manpath

Expand Down

0 comments on commit 5cf6f7f

Please sign in to comment.