Don't try to recognize git uri's

There's a bunch of different way to specify git uri's. Instead of trying
to recognize uri's let's just accept that the user knows, what he's doing.
This commit is contained in:
Jacob Atzen
2010-03-13 20:04:03 +01:00
committed by Joshua Nichols
parent 39c5142ee7
commit de0b14bbd6

View File

@@ -24,17 +24,16 @@ class Homesick < Thor
self.shell = Homesick::Shell.new self.shell = Homesick::Shell.new
end end
GIT_URI_PATTERN = /^git:\/\//
GITHUB_NAME_REPO_PATTERN = /([A-Za-z_-]+)\/([A-Za-z_-]+)/ GITHUB_NAME_REPO_PATTERN = /([A-Za-z_-]+)\/([A-Za-z_-]+)/
desc "clone URI", "Clone +uri+ as a castle for homesick" desc "clone URI", "Clone +uri+ as a castle for homesick"
def clone(uri) def clone(uri)
empty_directory repos_dir, :verbose => false empty_directory repos_dir, :verbose => false
inside repos_dir do inside repos_dir do
if uri =~ GIT_URI_PATTERN if uri =~ GITHUB_NAME_REPO_PATTERN
git_clone uri
elsif uri =~ GITHUB_NAME_REPO_PATTERN
git_clone "git://github.com/#{$1}/#{$2}.git", "#{$1}_#{$2}" git_clone "git://github.com/#{$1}/#{$2}.git", "#{$1}_#{$2}"
else
git_clone uri
end end
end end
end end