summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pitman <michaelp@ibglobalweb.com>2017-08-29 15:05:35 +1000
committerMichael Pitman <michaelp@ibglobalweb.com>2017-08-29 15:05:35 +1000
commite0846667872e02cc1b6a81767ebbecad843b4dc0 (patch)
treed0072cbe3e60a64784e03e4e6106b13c8efa8ef8
parent5b6b04439a6fe218c55680a12e74c2a3a76972c8 (diff)
downloadbundler-e0846667872e02cc1b6a81767ebbecad843b4dc0.tar.gz
Support ruby version 1.8.7 and rubygems earlier than version 2.0.0
-rw-r--r--lib/bundler/shared_helpers.rb3
-rw-r--r--spec/bundler/shared_helpers_spec.rb10
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(
/(?<!jar:file|jar|file|classpath|uri:classloader|uri|http|https):/
)
@@ -283,7 +287,7 @@ RSpec.describe Bundler::SharedHelpers do
expect { subject.send(:validate_bundle_path) }.not_to raise_error(Bundler::PathError)
end
- it "exits if bundle path contains another directory with the jruby uri path separator" do
+ it "exits if bundle path contains another directory with the jruby uri path separator", :ruby => "> 1.8.7" do
allow(Gem).to receive(:path_separator).and_return(
/(?<!jar:file|jar|file|classpath|uri:classloader|uri|http|https):/
)