summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2011-09-21 12:55:49 -0700
committerAndre Arko <andre@arko.net>2011-09-21 13:10:45 -0700
commit01bcd0000e43512b9788aeaf5179db7de67883df (patch)
tree8c3f996d3f6426f2e859a1e2135d119ced55df65
parentd263ce6e12a89ce8737b097b22457defd71e3e1a (diff)
downloadbundler-01bcd0000e43512b9788aeaf5179db7de67883df.tar.gz
don't explode when cwd is an invalid regex
fixes #1430
-rw-r--r--lib/bundler/cli.rb3
-rw-r--r--spec/install/gems/simple_case_spec.rb12
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 7b5f63d9ce..2e7bc6f549 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -220,7 +220,8 @@ module Bundler
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
diff --git a/spec/install/gems/simple_case_spec.rb b/spec/install/gems/simple_case_spec.rb
index 9beaa6ccd9..7838623321 100644
--- a/spec/install/gems/simple_case_spec.rb
+++ b/spec/install/gems/simple_case_spec.rb
@@ -471,6 +471,18 @@ describe "bundle install with gem sources" do
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