aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler/installer/standalone.rb
diff options
context:
space:
mode:
authorRy Biesemeyer <ry.biesemeyer@elastic.co>2021-12-02 16:09:36 +0000
committergit <svn-admin@ruby-lang.org>2023-09-27 05:20:58 +0000
commitbece8808744ee178a4c55c6954edd30fb93b9ad3 (patch)
tree32cc1edd33a6f08a7ffb27a1559a5348e022359f /lib/bundler/installer/standalone.rb
parenta812f1fed0e6e184447ca00b713d54b25be05911 (diff)
downloadruby-bece8808744ee178a4c55c6954edd30fb93b9ad3.tar.gz
[rubygems/rubygems] Centralize logic using `Pathname#relative_path_from`
To avoid potential crashes when trying to jump from a drive to another on Windows, and take the change refactor things a bit. https://github.com/rubygems/rubygems/commit/7c9a9a431a
Diffstat (limited to 'lib/bundler/installer/standalone.rb')
-rw-r--r--lib/bundler/installer/standalone.rb9
1 files changed, 1 insertions, 8 deletions
diff --git a/lib/bundler/installer/standalone.rb b/lib/bundler/installer/standalone.rb
index 2145e846f7..fed3d8c410 100644
--- a/lib/bundler/installer/standalone.rb
+++ b/lib/bundler/installer/standalone.rb
@@ -55,20 +55,13 @@ module Bundler
if spec.source.instance_of?(Source::Path) && spec.source.path.absolute?
full_path
else
- relative_path_from(Bundler.root.join(bundler_path), :to => full_path) || full_path
+ SharedHelpers.relative_path_to(full_path, :from => Bundler.root.join(bundler_path))
end
rescue TypeError
error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
raise Gem::InvalidSpecificationException.new(error_message)
end
- def relative_path_from(source, to:)
- Pathname.new(to).relative_path_from(source).to_s
- rescue ArgumentError
- # on Windows, if source and destination are on different drivers, there's no relative path from one to the other
- nil
- end
-
def define_path_helpers
<<~'END'
unless defined?(Gem)