diff options
author | Michael Pitman <michaelp@ibglobalweb.com> | 2017-08-28 20:54:31 +1000 |
---|---|---|
committer | Michael Pitman <michaelp@ibglobalweb.com> | 2017-08-28 20:54:31 +1000 |
commit | ec196cd54653879932f2e0fc3a2e0aec643405b2 (patch) | |
tree | b3f69be0b6569d2ff99c7a3d63a437a2a0a62c62 | |
parent | cda5ef70e2b07d5d78168b34eeeb9dc86df78894 (diff) | |
download | bundler-ec196cd54653879932f2e0fc3a2e0aec643405b2.tar.gz |
Use Gem.path_separator instead of File::PATH_SEPARATOR to detect an invalid bundle_path in order to work with jruby-generated war files. Fixes issue 5975
-rw-r--r-- | lib/bundler/shared_helpers.rb | 6 | ||||
-rw-r--r-- | spec/bundler/shared_helpers_spec.rb | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index bef9cc6139..adf9bbf000 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -221,12 +221,12 @@ module Bundler private def validate_bundle_path - return unless Bundler.bundle_path.to_s.include?(File::PATH_SEPARATOR) - message = "Your bundle path contains a '#{File::PATH_SEPARATOR}', " \ + return unless Bundler.bundle_path.to_s.split(Gem.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 " \ "system's PATH separator. Please change your " \ - "bundle path to not include '#{File::PATH_SEPARATOR}'." \ + "bundle path to not match #{Gem.path_separator.inspect}." \ "\nYour current bundle path is '#{Bundler.bundle_path}'." raise Bundler::PathError, message end diff --git a/spec/bundler/shared_helpers_spec.rb b/spec/bundler/shared_helpers_spec.rb index 66aaf2cf82..3c9dd263bc 100644 --- a/spec/bundler/shared_helpers_spec.rb +++ b/spec/bundler/shared_helpers_spec.rb @@ -262,15 +262,15 @@ RSpec.describe Bundler::SharedHelpers do end it "exits if bundle path contains the path separator" do - stub_const("File::PATH_SEPARATOR", ":".freeze) + allow(Gem).to receive(:path_separator).and_return(":") allow(Bundler).to receive(:bundle_path) { Pathname.new("so:me/dir/bin") } expect { subject.send(:validate_bundle_path) }.to raise_error( Bundler::PathError, - "Your bundle path contains a ':', which is the " \ + "Your bundle path contains text matching \":\", which is the " \ "path separator for your system. Bundler cannot " \ "function correctly when the Bundle path contains the " \ "system's PATH separator. Please change your " \ - "bundle path to not include ':'.\nYour current bundle " \ + "bundle path to not match \":\".\nYour current bundle " \ "path is '#{Bundler.bundle_path}'." ) end |