summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2017-08-30 15:13:20 +0000
committerThe Bundler Bot <bot@bundler.io>2017-08-30 15:13:20 +0000
commit570012724216e8a4f8cd2ffe9eb8acdfc94be133 (patch)
tree8ad81828ebc8185d971f66f9edb94f4c917ea829 /lib
parent46b4b2f23c3d50314bed694fc634380798ba0721 (diff)
parentbb817c6f0344fcee2c7310eaca250abee4819c2b (diff)
downloadbundler-570012724216e8a4f8cd2ffe9eb8acdfc94be133.tar.gz
Auto merge of #5978 - torcido:master, r=segiddins
Support bundle_path used by war files generated with jruby's warbler ### What was the end-user problem that led to this PR? Issue #5975. The problem was that recent code to detect a bad bundle_path by looking for the PATH_SEPARATOR character broke when running from a war file generated by jruby's warbler. ### What was your diagnosis of the problem? My diagnosis was that the path separator used was not appropriate in this circumstance. ### What is your fix for the problem, implemented in this PR? My fix implements the suggestion from @segiddins to use the same path splitting logic used by RubyGems under jruby to determine if the bad path is present. ### Why did you choose this fix out of the possible options? I chose this fix because it provides a way to detect the original problem that is consistent with the handling within RubyGems.
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/rubygems_integration.rb8
-rw-r--r--lib/bundler/shared_helpers.rb7
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 6f8a7608b0..1185625e03 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -208,6 +208,10 @@ module Bundler
Gem.bin_path(gem, bin, ver)
end
+ def path_separator
+ File::PATH_SEPARATOR
+ end
+
def preserve_paths
# this is a no-op outside of RubyGems 1.8
yield
@@ -788,6 +792,10 @@ module Bundler
def install_with_build_args(args)
yield
end
+
+ def path_separator
+ Gem.path_separator
+ end
end
# RubyGems 2.1.0
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb
index bef9cc6139..a18966b324 100644
--- a/lib/bundler/shared_helpers.rb
+++ b/lib/bundler/shared_helpers.rb
@@ -221,12 +221,13 @@ 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}', " \
+ path_separator = Bundler.rubygems.path_separator
+ return unless Bundler.bundle_path.to_s.split(path_separator).size > 1
+ message = "Your bundle path contains text matching #{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 #{path_separator.inspect}." \
"\nYour current bundle path is '#{Bundler.bundle_path}'."
raise Bundler::PathError, message
end