diff options
author | Leo Arnold <github@leoarnold.de> | 2018-10-10 23:35:48 +0200 |
---|---|---|
committer | Leo Arnold <github@leoarnold.de> | 2018-10-17 15:30:42 +0200 |
commit | 4e60117ece710fe99396d4a3f02d6430f7346fa3 (patch) | |
tree | 456cc07a39f12d2ba9734a04bca13323d081b6d2 /spec/support | |
parent | a144e72484ee16fb57a13fb1ba1a54ebefaf5b2e (diff) | |
download | bundler-4e60117ece710fe99396d4a3f02d6430f7346fa3.tar.gz |
Make RakeTask spec:deps OS agnostic
@segiddins encouraged contributions towards support for Windows
https://github.com/bundler/bundler/issues/5992#issuecomment-326809543
As a first step towards this goal this commit fixes file path specification
in the first pieces of Ruby code called when setting up a test environment.
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/path.rb | 8 | ||||
-rw-r--r-- | spec/support/rubygems_ext.rb | 12 |
2 files changed, 10 insertions, 10 deletions
diff --git a/spec/support/path.rb b/spec/support/path.rb index b24ac16d5b..8dd8f5a277 100644 --- a/spec/support/path.rb +++ b/spec/support/path.rb @@ -9,15 +9,15 @@ module Spec end def gemspec - @gemspec ||= Pathname.new(File.expand_path(root.join("bundler.gemspec"), __FILE__)) + @gemspec ||= root.join("bundler.gemspec") end def bindir - @bindir ||= Pathname.new(File.expand_path(root.join("exe"), __FILE__)) + @bindir ||= root.join("exe") end def spec_dir - @spec_dir ||= Pathname.new(File.expand_path(root.join("spec"), __FILE__)) + @spec_dir ||= root.join("spec") end def tmp(*path) @@ -95,7 +95,7 @@ module Spec end def bundler_path - Pathname.new(File.expand_path(root.join("lib"), __FILE__)) + root.join("lib") end def global_plugin_gem(*args) diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb index c18f7650fc..eff142118f 100644 --- a/spec/support/rubygems_ext.rb +++ b/spec/support/rubygems_ext.rb @@ -33,17 +33,17 @@ module Spec ENV["BUNDLE_PATH"] = nil ENV["GEM_HOME"] = ENV["GEM_PATH"] = Path.base_system_gems.to_s - ENV["PATH"] = [Path.bindir, "#{Path.system_gem_path}/bin", ENV["PATH"]].join(File::PATH_SEPARATOR) + ENV["PATH"] = [Path.bindir, Path.system_gem_path.join("bin"), ENV["PATH"]].join(File::PATH_SEPARATOR) manifest = DEPS.to_a.sort_by(&:first).map {|k, v| "#{k} => #{v}\n" } - manifest_path = "#{Path.base_system_gems}/manifest.txt" + manifest_path = Path.base_system_gems.join("manifest.txt") # it's OK if there are extra gems - if !File.exist?(manifest_path) || !(manifest - File.readlines(manifest_path)).empty? + if !manifest_path.file? || !(manifest - manifest_path.readlines).empty? FileUtils.rm_rf(Path.base_system_gems) FileUtils.mkdir_p(Path.base_system_gems) puts "installing gems for the tests to use..." install_gems(DEPS) - File.open(manifest_path, "w") {|f| f << manifest.join } + manifest_path.open("w") {|f| f << manifest.join } end ENV["HOME"] = Path.home.to_s @@ -60,9 +60,9 @@ module Spec reqs.map! {|name, req| "'#{name}:#{req}'" } deps = reqs.concat(no_reqs).join(" ") cmd = if Gem::VERSION < "2.0.0" - "gem install #{deps} --no-rdoc --no-ri --conservative" + "#{Gem.ruby} -S gem install #{deps} --no-rdoc --no-ri --conservative" else - "gem install #{deps} --no-document --conservative" + "#{Gem.ruby} -S gem install #{deps} --no-document --conservative" end puts cmd system(cmd) || raise("Installing gems #{deps} for the tests to use failed!") |