diff --git a/Rakefile b/Rakefile index 01fa454d..03ae76f9 100644 --- a/Rakefile +++ b/Rakefile @@ -110,6 +110,38 @@ task :link_vim_conf_files do end end +# Get a list of submodules +# +# @return [Array] of submodules +def submodules + `git submodule`.split("\n").collect { |s| s.split(" ")[1] } +end + +# Update a submodule +# +# @param [String] The submodule to update (relative path) +# @param [String] The branch we're tracking +def update_submodule(submodule, branch = "master") + Dir.chdir submodule do + puts + puts "*" * 40 + puts "*#{"Updating #{submodule}".center(38)}*" + puts "*" * 40 + puts + sh "git checkout #{branch}" + sh "git pull" + end +end + +namespace :dev do + desc "Update submodules" + task :update_submodules do + submodules.each do |submodule| + update_submodule(submodule) + end + end +end + desc "Create necessary folders." task :folders do Janus::VIM.folders.each do |folder|