diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-09 11:30:32 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-09 11:30:32 +0000 |
commit | 19ae6bc70dcd27fa79f703c092247eca483303d3 (patch) | |
tree | c7054c662de899404f25fc93c62bf8f0c5b3765f /spec/bundler/support/path.rb | |
parent | 4054b123d486d6b79cbb5f2b8cd6b2f4781ca563 (diff) | |
download | ruby-19ae6bc70dcd27fa79f703c092247eca483303d3.tar.gz |
spec/bundler/support: paths for ruby core
* spec/bundler/support/path.rb (Spec::Path#for_ruby_core?): helper
method to tell whether running in Ruby Core or not.
* spec/bundler/support/helpers.rb (Spec::Helpers#bundle): use
Path.bindir for ruby core case.
* spec/bundler/support/rubygems_ext.rb (Spec::Rubygems.setup):
ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/bundler/support/path.rb')
-rw-r--r-- | spec/bundler/support/path.rb | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb index f28d660e83..b58658e71a 100644 --- a/spec/bundler/support/path.rb +++ b/spec/bundler/support/path.rb @@ -4,43 +4,20 @@ require "pathname" module Spec module Path def root - if !!(ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"]) - # for Ruby Core - root_path = File.expand_path("../../../..", __FILE__) - else - root_path = File.expand_path("../../..", __FILE__) - end - @root ||= Pathname.new(root_path) + @root ||= + Pathname.new(for_ruby_core? ? "../../../.." : "../../..").expand_path(__FILE__) end def gemspec - if !!(ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"]) - # for Ruby Core - gemspec_path = File.expand_path(root.join("lib/bundler.gemspec"), __FILE__) - else - gemspec_path = File.expand_path(root.join("bundler.gemspec"), __FILE__) - end - @gemspec ||= Pathname.new(gemspec_path) + @gemspec ||= root.join(for_ruby_core? ? "lib/bundler.gemspec" : "bundler.gemspec") end def bindir - if !!(ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"]) - # for Ruby Core - bin_path = File.expand_path(root.join("bin"), __FILE__) - else - bin_path = File.expand_path(root.join("exe"), __FILE__) - end - @bindir ||= Pathname.new(bin_path) + @bindir ||= root.join(for_ruby_core? ? "bin" : "exe") end def spec_dir - if !!(ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"]) - # for Ruby Core - spec_path = File.expand_path(root.join("spec/bundler"), __FILE__) - else - spec_path = File.expand_path(root.join("spec"), __FILE__) - end - @spec_dir ||= Pathname.new(spec_path) + @spec_dir ||= root.join(for_ruby_core? ? "spec/bundler" : "spec") end def tmp(*path) @@ -130,5 +107,14 @@ module Spec end extend self + + private + def for_ruby_core? + if @for_ruby_core.nil? + @for_ruby_core = true & (ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"]) + else + @for_ruby_core + end + end end end |