Permalink
Browse files

In fact, treat all protocols except for git:// as private.

* http:// could be private like https:// can, with basic auth. In practice, it's not really used.
* file:// refers to a local path, which is private. This isn't really used either.
  • Loading branch information...
benhoskings committed Aug 19, 2012
1 parent 9463f42 commit d2d487938e617c99d208ef1eed2f5f2889f6c090
Showing with 9 additions and 7 deletions.
  1. +4 −2 lib/babushka/source.rb
  2. +5 −5 spec/babushka/source_spec.rb
View
@@ -45,10 +45,12 @@ def self.default_remote_for name
def self.discover_uri_and_type path
if path.nil?
[nil, :implicit]
- elsif path.to_s.sub(/^\w+:\/\//, '')[/^[^\/]+[@:]/] || path.to_s[/^https:\/\//]
+ elsif path.to_s.sub(/^\w+:\/\//, '')[/^[^\/]+[@:]/]
[path.to_s, :private]
- elsif path.to_s[/^(git|http|file):\/\//]
+ elsif path.to_s[/^git:\/\//]
[path.to_s, :public]
+ elsif path.to_s[/^\w+:\/\//]
+ [path.to_s, :private]
else
[path.p, :local]
end
@@ -27,18 +27,18 @@
Source.discover_uri_and_type(uri).should == [uri, :private]
}
end
- it "should treat git:// and friends as public" do
+ it "should treat git:// as public" do
[
'git://github.com/benhoskings/babushka-deps.git',
- 'http://github.com/benhoskings/babushka-deps.git',
- 'file:///Users/ben/babushka/deps'
].each {|uri|
Source.discover_uri_and_type(uri).should == [uri, :public]
}
end
- it "should treat https:// as private" do
+ it "should treat other protocols as private" do
[
- 'https://github.com/benhoskings/babushka-deps.git'
+ 'http://github.com/benhoskings/babushka-deps.git',
+ 'https://github.com/benhoskings/babushka-deps.git',
+ 'file:///Users/ben/babushka/deps'
].each {|uri|
Source.discover_uri_and_type(uri).should == [uri, :private]
}

0 comments on commit d2d4879

Please sign in to comment.