summaryrefslogtreecommitdiff
path: root/spec/support/path.rb
diff options
context:
space:
mode:
authorSHIBATA Hiroshi <hsbt@ruby-lang.org>2018-11-01 21:49:41 +0900
committerSHIBATA Hiroshi <hsbt@ruby-lang.org>2018-11-01 22:02:59 +0900
commit09bfdfa31ad5ae34d29745344493f6a63d355804 (patch)
tree9c533bb34d9fa5ea818c13e9422efee9757e1b9d /spec/support/path.rb
parent6d2c0d2a199564a75612eb492adec5e27eaa923d (diff)
downloadbundler-09bfdfa31ad5ae34d29745344493f6a63d355804.tar.gz
Backport from ruby core
Diffstat (limited to 'spec/support/path.rb')
-rw-r--r--spec/support/path.rb24
1 files changed, 11 insertions, 13 deletions
diff --git a/spec/support/path.rb b/spec/support/path.rb
index 1a3444f365..cecab45c9b 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(for_ruby_core? ? "../../../.." : "../../..").expand_path(__FILE__)
+ @root ||= Pathname.new(ruby_core? ? "../../../.." : "../../..").expand_path(__FILE__)
end
def gemspec
- @gemspec ||= root.join(for_ruby_core? ? "lib/bundler.gemspec" : "bundler.gemspec")
+ @gemspec ||= root.join(ruby_core? ? "lib/bundler.gemspec" : "bundler.gemspec")
end
def bindir
- @bindir ||= root.join(for_ruby_core? ? "bin" : "exe")
+ @bindir ||= root.join(ruby_core? ? "bin" : "exe")
end
def spec_dir
- @spec_dir ||= root.join(for_ruby_core? ? "spec/bundler" : "spec")
+ @spec_dir ||= root.join(ruby_core? ? "spec/bundler" : "spec")
end
def tmp(*path)
@@ -110,19 +110,17 @@ module Spec
tmp "tmpdir", *args
end
- extend self
-
- private
-
- def for_ruby_core?
+ def ruby_core?
# avoid to wornings
- @for_ruby_core ||= nil
+ @ruby_core ||= nil
- if @for_ruby_core.nil?
- @for_ruby_core = true & (ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"])
+ if @ruby_core.nil?
+ @ruby_core = true & (ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"])
else
- @for_ruby_core
+ @ruby_core
end
end
+
+ extend self
end
end