From c07a034fa18b9830dcfbff748737a70c41515ebc Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Sun, 20 May 2012 02:00:57 +0200 Subject: [PATCH] Use "git submodule foreach" to update submodules --- Rakefile | 4 +--- janus/ruby/janus.rb | 1 - janus/ruby/janus/git.rb | 24 ------------------------ 3 files changed, 1 insertion(+), 28 deletions(-) delete mode 100644 janus/ruby/janus/git.rb diff --git a/Rakefile b/Rakefile index fd5d04ce..269f796c 100644 --- a/Rakefile +++ b/Rakefile @@ -18,9 +18,7 @@ end namespace :dev do desc "Update submodules" task :update_submodules do - submodules.each do |submodule| - update_submodule(submodule) - end + sh "git submodule foreach git pull origin master" end # Taken from RefineryCMD diff --git a/janus/ruby/janus.rb b/janus/ruby/janus.rb index 98927dca..8291edee 100644 --- a/janus/ruby/janus.rb +++ b/janus/ruby/janus.rb @@ -51,7 +51,6 @@ def sudo(*args) end require 'janus/errors' -require 'janus/git' require 'janus/vim' require 'janus/gems' require 'janus/github' diff --git a/janus/ruby/janus/git.rb b/janus/ruby/janus/git.rb deleted file mode 100644 index 18d5dc37..00000000 --- a/janus/ruby/janus/git.rb +++ /dev/null @@ -1,24 +0,0 @@ -module Janus - # 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 -end