Handle cloning of uri's based on ssh aliases like host:repos

This commit is contained in:
Jacob Atzen
2010-08-17 10:09:23 +02:00
parent 0440cd672d
commit f9c351f941
2 changed files with 9 additions and 0 deletions

View File

@@ -30,6 +30,9 @@ class Homesick < Thor
elsif uri =~ /\/([^\/]*)(\.git)?\Z/
destination = Pathname.new($1)
git_clone uri
elsif uri =~ /[^:]+:([^:]+)(\.git)?\Z/
destination = Pathname.new($1)
git_clone uri
else
raise "Unknown URI format: #{uri}"
end

View File

@@ -40,6 +40,12 @@ describe Homesick do
@homesick.clone 'http://github.com/technicalpickles/pickled-vim'
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
@homesick.should_not_receive(:git_clone)