Delete path including /../ too

This commit is contained in:
Kazuhiro NISHIYAMA 2021-01-28 17:54:29 +09:00
parent edaf0c250c
commit 00bd645f09
No known key found for this signature in database
GPG key ID: 262ED8DBB4222F7A

View file

@ -123,7 +123,10 @@ module Spec
require_path = name == "bundler" ? "#{lib_dir}/bundler" : name.tr("-", "/") require_path = name == "bundler" ? "#{lib_dir}/bundler" : name.tr("-", "/")
version_const = name == "bundler" ? "Bundler::VERSION" : Spec::Builders.constantize(name) version_const = name == "bundler" ? "Bundler::VERSION" : Spec::Builders.constantize(name)
code = [] code = []
code << "$LOAD_PATH.delete '#{exclude_from_load_path}'" if exclude_from_load_path if exclude_from_load_path
code << "exclude_from_load_path = File.expand_path('#{exclude_from_load_path}')"
code << "$LOAD_PATH.delete_if { |path| File.expand_path(path) == exclude_from_load_path }"
end
code << "require '#{require_path}.rb'" code << "require '#{require_path}.rb'"
code << "puts #{version_const}" code << "puts #{version_const}"
run code.join("; "), *groups run code.join("; "), *groups