diff options
Diffstat (limited to 'spec/bundler/support/path.rb')
-rw-r--r-- | spec/bundler/support/path.rb | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb index 62f136aa0b..a9e9704cf9 100644 --- a/spec/bundler/support/path.rb +++ b/spec/bundler/support/path.rb @@ -6,7 +6,7 @@ require "rbconfig" module Spec module Path def source_root - @source_root ||= Pathname.new(ruby_core? ? "../../../.." : "../../..").expand_path(__FILE__) + @source_root ||= Pathname.new(ruby_core? ? "../../.." : "../..").expand_path(__dir__) end def root @@ -30,7 +30,15 @@ module Spec end def test_gemfile - @test_gemfile ||= source_root.join(ruby_core? ? "tool/bundler/test_gems.rb" : "test_gems.rb") + @test_gemfile ||= source_root.join("tool/bundler/test_gems.rb") + end + + def rubocop_gemfile + @rubocop_gemfile ||= source_root.join(rubocop_gemfile_basename) + end + + def standard_gemfile + @standard_gemfile ||= source_root.join(standard_gemfile_basename) end def dev_gemfile @@ -119,7 +127,7 @@ module Spec end def vendored_gems(path = nil) - bundled_app(*["vendor/bundle", Gem.ruby_engine, RbConfig::CONFIG["ruby_version"], path].compact) + scoped_gem_path(bundled_app("vendor/bundle")).join(*[path].compact) end def cached_gem(path) @@ -138,6 +146,14 @@ module Spec tmp.join("gems/base") end + def rubocop_gems + tmp.join("gems/rubocop") + end + + def standard_gems + tmp.join("gems/standard") + end + def file_uri_for(path) protocol = "file://" root = Gem.win_platform? ? "/" : "" @@ -178,7 +194,11 @@ module Spec end def local_gem_path(*path, base: bundled_app) - base.join(*[".bundle", Gem.ruby_engine, RbConfig::CONFIG["ruby_version"], *path].compact) + scoped_gem_path(base.join(".bundle")).join(*path) + end + + def scoped_gem_path(base) + base.join(Gem.ruby_engine, RbConfig::CONFIG["ruby_version"]) end def lib_path(*args) @@ -193,10 +213,6 @@ module Spec root.join("lib") end - def xdg_config_home - home(".config") - end - def global_plugin_gem(*args) home ".bundle", "plugin", "gems", *args end @@ -255,6 +271,14 @@ module Spec !git_root.join(".git").directory? end + def rubocop_gemfile_basename + source_root.join("tool/bundler/#{RUBY_VERSION.start_with?("2.3") ? "rubocop23_gems.rb" : "rubocop_gems.rb"}") + end + + def standard_gemfile_basename + source_root.join("tool/bundler/#{RUBY_VERSION.start_with?("2.3") ? "standard23_gems.rb" : "standard_gems.rb"}") + end + extend self end end |