Handle cloning of uri's based on ssh aliases like host:repos
This commit is contained in:
@@ -30,6 +30,9 @@ class Homesick < Thor
|
|||||||
elsif uri =~ /\/([^\/]*)(\.git)?\Z/
|
elsif uri =~ /\/([^\/]*)(\.git)?\Z/
|
||||||
destination = Pathname.new($1)
|
destination = Pathname.new($1)
|
||||||
git_clone uri
|
git_clone uri
|
||||||
|
elsif uri =~ /[^:]+:([^:]+)(\.git)?\Z/
|
||||||
|
destination = Pathname.new($1)
|
||||||
|
git_clone uri
|
||||||
else
|
else
|
||||||
raise "Unknown URI format: #{uri}"
|
raise "Unknown URI format: #{uri}"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -40,6 +40,12 @@ describe Homesick do
|
|||||||
@homesick.clone 'http://github.com/technicalpickles/pickled-vim'
|
@homesick.clone 'http://github.com/technicalpickles/pickled-vim'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should clone git repo like host-alias:repos.git" do
|
||||||
|
@homesick.should_receive(:git_clone).with('gitolite:pickled-vim.git')
|
||||||
|
|
||||||
|
@homesick.clone 'gitolite:pickled-vim.git'
|
||||||
|
end
|
||||||
|
|
||||||
it "should not try to clone a malformed uri like malformed" do
|
it "should not try to clone a malformed uri like malformed" do
|
||||||
@homesick.should_not_receive(:git_clone)
|
@homesick.should_not_receive(:git_clone)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user