From 4cfbb132758d5bbea287b55bfeaae382867396ba Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Thu, 12 Jul 2018 12:07:36 +0900 Subject: [PATCH 1/2] To use --no-document option after RubyGems 2.0. RubyGems will remove --no-ri and --no-rdoc options at RubyGems 3.0 --- Rakefile | 2 +- spec/support/helpers.rb | 6 +++++- spec/support/rubygems_ext.rb | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index 2f7db8253c8..a4e4b19db25 100644 --- a/Rakefile +++ b/Rakefile @@ -56,7 +56,7 @@ namespace :spec do sh %(#{Gem.ruby} -S gem #{gem_install_command}) end else - gem_install_command = "install --no-ri --no-rdoc --conservative " + deps.sort_by {|name, _| name }.map do |name, version| + gem_install_command = "install --no-document --conservative " + deps.sort_by {|name, _| name }.map do |name, version| "'#{name}:#{version}'" end.join(" ") sh %(#{Gem.ruby} -S gem #{gem_install_command}) diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index fbc7cdadc68..e2b96f5d210 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -319,7 +319,11 @@ def install_gems(*gems) raise "OMG `#{path}` does not exist!" unless File.exist?(path) - gem_command! :install, "--no-rdoc --no-ri --ignore-dependencies '#{path}'" + if Gem::VERSION < "2.0.0" + gem_command! :install, "--no-rdoc --no-ri --ignore-dependencies '#{path}'" + else + gem_command! :install, "--no-document --ignore-dependencies '#{path}'" + end bundler_path && bundler_path.rmtree end end diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb index 3627e5a71d2..80e8d346d4a 100644 --- a/spec/support/rubygems_ext.rb +++ b/spec/support/rubygems_ext.rb @@ -59,7 +59,11 @@ def self.install_gems(gems) no_reqs.map!(&:first) reqs.map! {|name, req| "'#{name}:#{req}'" } deps = reqs.concat(no_reqs).join(" ") - cmd = "gem install #{deps} --no-rdoc --no-ri --conservative" + if Gem::VERSION < "2.0.0" + cmd = "gem install #{deps} --no-rdoc --no-ri --conservative" + else + cmd = "gem install #{deps} --no-document --conservative" + end puts cmd system(cmd) || raise("Installing gems #{deps} for the tests to use failed!") end From b998ee59492d84ed380ec77385f2687d1f64ea7b Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Thu, 12 Jul 2018 12:58:25 +0900 Subject: [PATCH 2/2] rubocop -a --- spec/support/rubygems_ext.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb index 80e8d346d4a..806933fe2f1 100644 --- a/spec/support/rubygems_ext.rb +++ b/spec/support/rubygems_ext.rb @@ -59,10 +59,10 @@ def self.install_gems(gems) no_reqs.map!(&:first) reqs.map! {|name, req| "'#{name}:#{req}'" } deps = reqs.concat(no_reqs).join(" ") - if Gem::VERSION < "2.0.0" - cmd = "gem install #{deps} --no-rdoc --no-ri --conservative" + cmd = if Gem::VERSION < "2.0.0" + "gem install #{deps} --no-rdoc --no-ri --conservative" else - cmd = "gem install #{deps} --no-document --conservative" + "gem install #{deps} --no-document --conservative" end puts cmd system(cmd) || raise("Installing gems #{deps} for the tests to use failed!")