From 2e8e103f42a81c39058feace314a78667f8b316f Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Thu, 21 Feb 2013 17:15:39 -0500 Subject: handle submodule updates and url changes If a submodule had an update, it would show up as a + in the 'git submodule status' output, and thus would not be automatically updated because we were only looking for '-', so the regexp was changed to look for + as well as - Additionally, add a 'git submodule sync' on every run in order to capture the case where an upstream submodule URL was changed. This doesn't happen often, but it can be quite painful when it does, and fortunately 'git submodule sync' is a local (and thus, cheap) command. --- lib/leap_cli/commands/deploy.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/leap_cli/commands/deploy.rb') diff --git a/lib/leap_cli/commands/deploy.rb b/lib/leap_cli/commands/deploy.rb index 115f06c..b5595f0 100644 --- a/lib/leap_cli/commands/deploy.rb +++ b/lib/leap_cli/commands/deploy.rb @@ -96,9 +96,10 @@ module LeapCli def init_submodules Dir.chdir Path.platform do + assert_run! "git submodule sync" statuses = assert_run! "git submodule status" statuses.strip.split("\n").each do |status_line| - if status_line =~ /^-/ + if status_line =~ /^[\+-]/ submodule = status_line.split(' ')[1] log "Updating submodule #{submodule}" assert_run! "git submodule update --init #{submodule}" -- cgit v1.2.3