Refactor the clone method to decrease its cyclomatic complexity

This commit is contained in:
Nicolas McCurdy
2014-01-07 02:48:50 -05:00
parent 571c5799e9
commit c667cefd4c
3 changed files with 15 additions and 14 deletions

View File

@@ -16,6 +16,17 @@ class Homesick
say_status 'git clone', "#{repo} to #{destination.expand_path}", :green unless options[:quiet]
system "git clone -q --config push.default=upstream --recursive #{repo} #{destination}" unless options[:pretend]
end
git_setup_submodules destination
end
def git_setup_submodules(path)
if path.join('.gitmodules').exist?
inside path do
git_submodule_init
git_submodule_update
end
end
end
def git_init(path = '.')