Skip to content
This repository has been archived by the owner on Dec 24, 2019. It is now read-only.

Commit

Permalink
In fact, treat all protocols except for git:// as private.
Browse files Browse the repository at this point in the history
* 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 d2d4879
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 4 additions & 2 deletions lib/babushka/source.rb
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions spec/babushka/source_spec.rb
Expand Up @@ -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]
}
Expand Down

0 comments on commit d2d4879

Please sign in to comment.