Skip to content

Commit

Permalink
Implemented #139: Add installing for submodules
Browse files Browse the repository at this point in the history
 - (It must be ran from the root git directory.)
  • Loading branch information
andkirby committed Aug 1, 2017
1 parent 33dbe5e commit c137dcd
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/shell/install-submodules.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
: <<'LCS'
/**
* @license https://raw.githubusercontent.com/andkirby/commithook/master/LICENSE.md
*/
LCS

set -o errexit
set -o pipefail
set -o nounset
#set -o xtrace

# Set magic variables for current file & dir
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
readonly __dir __file

if commithook 2>&1 > /dev/null; then
commithook_bin=$(type commithook | awk '{print $NF}' | tr -d "'\`")
else
commithook_bin=${__dir}/../../bin/commithook
fi

current_pwd=$(pwd)

submodule_paths() {
cat ${current_pwd}/.gitmodules \
| grep 'path = ' | awk '{print $3}'
}

while read module_path; do
cd ${module_path}
${commithook_bin} install
done < <(submodule_paths)

0 comments on commit c137dcd

Please sign in to comment.