summaryrefslogtreecommitdiff
path: root/spec/bundler/support/path.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/bundler/support/path.rb')
-rw-r--r--spec/bundler/support/path.rb24
1 files changed, 20 insertions, 4 deletions
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb
index 56d3c71f3c..483c7da347 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,11 @@ 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 dev_gemfile
@@ -119,7 +123,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 +142,10 @@ module Spec
tmp.join("gems/base")
end
+ def rubocop_gems
+ tmp.join("gems/rubocop")
+ end
+
def file_uri_for(path)
protocol = "file://"
root = Gem.win_platform? ? "/" : ""
@@ -178,7 +186,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)
@@ -251,6 +263,10 @@ 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
+
extend self
end
end