Adds a bit of functionality to the clone command.
* You can give it user/repo style arguments for github repositories. * If the repo has already been cloned into homes_dir, we don't try to clone again.
This commit is contained in:
@@ -7,7 +7,16 @@ class Homesick < Thor
|
|||||||
def clone(uri)
|
def clone(uri)
|
||||||
empty_directory homes_dir
|
empty_directory homes_dir
|
||||||
inside homes_dir do
|
inside homes_dir do
|
||||||
run "git clone #{uri}"
|
if uri =~ /^git:\/\//
|
||||||
|
unless File.directory? "#{homes_dir}/#{uri[/[A-Za-z_-]+\/[A-Za-z_-]+$/]}"
|
||||||
|
run "git clone #{uri}"
|
||||||
|
end
|
||||||
|
elsif uri =~ /^[A-Za-z_-]+\/[A-Za-z_-]+$/
|
||||||
|
match = uri.match(/([A-Za-z_-]+)\/([A-Za-z_-]+)/)
|
||||||
|
unless File.directory? "#{homes_dir}/#{match[1]}_#{match[2]}"
|
||||||
|
run "git clone git://github.com/#{match[0]} #{match[1]}_#{match[2]}"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user