aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/test_case.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-31 03:23:30 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-31 03:23:30 +0000
commit3e047420d69240af98add002e7a3025004094379 (patch)
tree695da063eea6090f531678042512d940b08691bf /lib/rubygems/test_case.rb
parent6f5eb285077d9abf8f97056531996c58674b570c (diff)
downloadruby-3e047420d69240af98add002e7a3025004094379.tar.gz
Merge upstream from rubygems/rubygems master branch.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/test_case.rb')
-rw-r--r--lib/rubygems/test_case.rb21
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index 718571ea57..fc9456709f 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -1319,9 +1319,26 @@ Also, a list:
end
end
+ class << self
+ # :nodoc:
+ ##
+ # Return the join path, with escaping backticks, dollars, and
+ # double-quotes. Unlike `shellescape`, equal-sign is not escaped.
+ private
+ def escape_path(*path)
+ path = File.join(*path)
+ if %r'\A[-+:/=@,.\w]+\z' =~ path
+ path
+ else
+ "\"#{path.gsub(/[`$"]/, '\\&')}\""
+ end
+ end
+ end
+
@@ruby = rubybin
- @@good_rake = "#{rubybin} \"#{File.expand_path('../../../test/rubygems/good_rake.rb', __FILE__)}\""
- @@bad_rake = "#{rubybin} \"#{File.expand_path('../../../test/rubygems/bad_rake.rb', __FILE__)}\""
+ gempath = File.expand_path('../../../test/rubygems', __FILE__)
+ @@good_rake = "#{rubybin} #{escape_path(gempath, 'good_rake.rb')}"
+ @@bad_rake = "#{rubybin} #{escape_path(gempath, 'bad_rake.rb')}"
##
# Construct a new Gem::Dependency.