From e0846667872e02cc1b6a81767ebbecad843b4dc0 Mon Sep 17 00:00:00 2001 From: Michael Pitman Date: Tue, 29 Aug 2017 15:05:35 +1000 Subject: Support ruby version 1.8.7 and rubygems earlier than version 2.0.0 --- lib/bundler/shared_helpers.rb | 3 ++- spec/bundler/shared_helpers_spec.rb | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index adf9bbf000..74710b5f51 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -221,7 +221,8 @@ module Bundler private def validate_bundle_path - return unless Bundler.bundle_path.to_s.split(Gem.path_separator).size > 1 + path_separator = Gem.respond_to?(:path_separator) ? Gem.path_separator : File::PATH_SEPARATOR + return unless Bundler.bundle_path.to_s.split(path_separator).size > 1 message = "Your bundle path contains text matching #{Gem.path_separator.inspect}, " \ "which is the path separator for your system. Bundler cannot " \ "function correctly when the Bundle path contains the " \ diff --git a/spec/bundler/shared_helpers_spec.rb b/spec/bundler/shared_helpers_spec.rb index 976f2f6335..d5f1a826c5 100644 --- a/spec/bundler/shared_helpers_spec.rb +++ b/spec/bundler/shared_helpers_spec.rb @@ -262,7 +262,11 @@ RSpec.describe Bundler::SharedHelpers do end it "exits if bundle path contains the unix-like path separator" do - allow(Gem).to receive(:path_separator).and_return(":") + if Gem.respond_to?(:path_separator) + allow(Gem).to receive(:path_separator).and_return(":") + else + stub_const("File::PATH_SEPARATOR", ":".freeze) + end allow(Bundler).to receive(:bundle_path) { Pathname.new("so:me/dir/bin") } expect { subject.send(:validate_bundle_path) }.to raise_error( Bundler::PathError, @@ -275,7 +279,7 @@ RSpec.describe Bundler::SharedHelpers do ) end - it "does not exit if bundle path is the jruby/warbler standard uri path" do + it "does not exit if bundle path is the jruby/warbler standard uri path", :ruby => "> 1.8.7" do allow(Gem).to receive(:path_separator).and_return( /(? "> 1.8.7" do allow(Gem).to receive(:path_separator).and_return( /(?