summaryrefslogtreecommitdiff
path: root/spec/support/path.rb
diff options
context:
space:
mode:
authorSHIBATA Hiroshi <hsbt@ruby-lang.org>2018-10-16 20:45:45 +0900
committerSHIBATA Hiroshi <hsbt@ruby-lang.org>2018-10-20 20:00:39 +0900
commit5417b218c499db48b23de2bdc38ba2f33d3223c0 (patch)
tree8556a1c1d8e5811f86d2e63b931c1212ae40413a /spec/support/path.rb
parentce655f16ca1cc4b07af4bb981c20636bc6b02c84 (diff)
downloadbundler-5417b218c499db48b23de2bdc38ba2f33d3223c0.tar.gz
Added to support BUNDLE_RUBY and BUNDLE_GEM environmental variables.
They are replaced build binary on ruby core repository.
Diffstat (limited to 'spec/support/path.rb')
-rw-r--r--spec/support/path.rb20
1 files changed, 16 insertions, 4 deletions
diff --git a/spec/support/path.rb b/spec/support/path.rb
index 8dd8f5a277..d57a2282f0 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(for_ruby_core? ? "../../../.." : "../../..").expand_path(__FILE__)
end
def gemspec
- @gemspec ||= root.join("bundler.gemspec")
+ @gemspec ||= root.join(for_ruby_core? ? "lib/bundler.gemspec" : "bundler.gemspec")
end
def bindir
- @bindir ||= root.join("exe")
+ @bindir ||= root.join(for_ruby_core? ? "bin" : "exe")
end
def spec_dir
- @spec_dir ||= root.join("spec")
+ @spec_dir ||= root.join(for_ruby_core? ? "spec/bundler" : "spec")
end
def tmp(*path)
@@ -111,5 +111,17 @@ module Spec
end
extend self
+
+ private
+ def for_ruby_core?
+ # avoid to wornings
+ @for_ruby_core ||= nil
+
+ if @for_ruby_core.nil?
+ @for_ruby_core = true & (ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"])
+ else
+ @for_ruby_core
+ end
+ end
end
end