diff options
Diffstat (limited to 'spec/support/path.rb')
-rw-r--r-- | spec/support/path.rb | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/spec/support/path.rb b/spec/support/path.rb index a8bc50f5f4..97153226bd 100644 --- a/spec/support/path.rb +++ b/spec/support/path.rb @@ -5,19 +5,19 @@ require "pathname" module Spec module Path def root - @root ||= Pathname.new(File.expand_path("../../..", __FILE__)) + @root ||= Pathname.new(ruby_core? ? "../../../.." : "../../..").expand_path(__FILE__) end def gemspec - @gemspec ||= Pathname.new(File.expand_path(root.join("bundler.gemspec"), __FILE__)) + @gemspec ||= root.join(ruby_core? ? "lib/bundler.gemspec" : "bundler.gemspec") end def bindir - @bindir ||= Pathname.new(File.expand_path(root.join("exe"), __FILE__)) + @bindir ||= root.join(ruby_core? ? "bin" : "exe") end def spec_dir - @spec_dir ||= Pathname.new(File.expand_path(root.join("spec"), __FILE__)) + @spec_dir ||= root.join(ruby_core? ? "spec/bundler" : "spec") end def tmp(*path) @@ -110,6 +110,17 @@ module Spec tmp "tmpdir", *args end + def ruby_core? + # avoid to wornings + @ruby_core ||= nil + + if @ruby_core.nil? + @ruby_core = true & (ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"]) + else + @ruby_core + end + end + extend self end end |