aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhasimo <sulky.to@gmail.com>2010-03-03 06:32:18 +0900
committerAndre Arko <andre@arko.net>2010-03-04 16:08:25 -0800
commitf3bdcf3b83a13be59df69f40799c13cf1a7d2664 (patch)
treeecabc85f868a3da78c45a12f09822370a591f68c
parent250b934874162681d638debefea5c940f4883ba8 (diff)
downloadbundler-f3bdcf3b83a13be59df69f40799c13cf1a7d2664.tar.gz
Git#base_name should escape dirpath.
-rw-r--r--lib/bundler/source.rb2
-rw-r--r--spec/cache/git_spec.rb9
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb
index c8cea746..2245fa9c 100644
--- a/lib/bundler/source.rb
+++ b/lib/bundler/source.rb
@@ -276,7 +276,7 @@ module Bundler
end
def base_name
- File.basename(uri, ".git")
+ File.basename(uri.sub(%r{^(\w+://)?([^/:]+:)},''), ".git")
end
def uri_hash
diff --git a/spec/cache/git_spec.rb b/spec/cache/git_spec.rb
index e69de29b..82ba8a62 100644
--- a/spec/cache/git_spec.rb
+++ b/spec/cache/git_spec.rb
@@ -0,0 +1,9 @@
+require File.expand_path('../../spec_helper', __FILE__)
+describe "bundle cache with git" do
+ it "base_name should strip private repo uris" do
+ source = Bundler::Source::Git.new("uri" => "git@gitthub.com:bundler.git")
+ source.send(:base_name).should == "bundler"
+ end
+end
+
+