Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

[Experimental] Rakefile: Add a task to easly update all submodules. #284

Closed
wants to merge 1 commit into from

2 participants

@kalbasit
Owner

This pull request adds the rake task "dev:update_submodules" which goes into each of the submodules and runs git pull on it (it switches to the master branch first)

@wycats wycats closed this pull request from a commit
@kalbasit kalbasit Merge branch 'add_dev_update_submodules' into my_pulls
closes #284

* add_dev_update_submodules:
  Rakefile: Add a task to easly update all submodules.

Conflicts:
	Rakefile
12a3bfc
@wycats wycats closed this in 12a3bfc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 2, 2011
  1. @kalbasit
This page is out of date. Refresh to see the latest.
Showing with 32 additions and 0 deletions.
  1. +32 −0 Rakefile
View
32 Rakefile
@@ -6,6 +6,38 @@ task expand("~/.vimrc") => "vimrc" do
sh "ln -s ~/.vim/vimrc ~/.vimrc"
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
+
task expand("~/.gvimrc") => "gvimrc" do
sh "ln -s ~/.vim/gvimrc ~/.gvimrc"
end
Something went wrong with that request. Please try again.