Permalink
Browse files

don't explode when cwd is an invalid regex

fixes #1430
  • Loading branch information...
1 parent d263ce6 commit 01bcd0000e43512b9788aeaf5179db7de67883df @indirect indirect committed Sep 21, 2011
Showing with 14 additions and 1 deletion.
  1. +2 −1 lib/bundler/cli.rb
  2. +12 −0 spec/install/gems/simple_case_spec.rb
View
3 lib/bundler/cli.rb
@@ -220,7 +220,8 @@ def install(path = nil)
Bundler.load.cache if Bundler.root.join("vendor/cache").exist? && !options["no-cache"]
if Bundler.settings[:path]
- relative_path = File.expand_path(Bundler.settings[:path]).sub(/^#{File.expand_path('.')}/, '.')
+ absolute_path = File.expand_path(Bundler.settings[:path])
+ relative_path = absolute_path.sub(File.expand_path('.'), '.')
Bundler.ui.confirm "Your bundle is complete! " +
"It was installed into #{relative_path}"
else
View
12 spec/install/gems/simple_case_spec.rb
@@ -471,6 +471,18 @@ def set_bundle_path(type, location)
out.should include "The disable-shared-gem option is no longer available"
end
+ it "handles paths with regex characters in them" do
+ dir = bundled_app("bun++dle")
+ dir.mkpath
+
+ Dir.chdir(dir) do
+ bundle "install --path vendor/bundle"
+ out.should include("installed into ./vendor/bundle")
+ end
+
+ dir.rmtree
+ end
+
["install vendor/bundle", "install --path vendor/bundle"].each do |install|
if install == "install vendor/bundle"
it "displays the deprecation warning for path as an argument to install" do

0 comments on commit 01bcd00

Please sign in to comment.