From 99ff3bab75610392f2503e68f3ea10d92be518b6 Mon Sep 17 00:00:00 2001 From: bigeagle Date: Tue, 31 May 2016 14:21:27 +0800 Subject: [PATCH] added cocoapods --- cocoapods.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 cocoapods.sh diff --git a/cocoapods.sh b/cocoapods.sh new file mode 100755 index 0000000..f47aef4 --- /dev/null +++ b/cocoapods.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -e + +function repo_init() { + UPSTREAM=$1 + WORKING_DIR=$2 + git clone --mirror $UPSTREAM $WORKING_DIR +} + +function update_cocoapods_git() { + repo_dir="$1" + cd $repo_dir + echo "==== SYNC $repo_dir START ====" + /usr/bin/timeout -s INT 3600 git remote -v update + git repack -a -b -d + echo "==== SYNC $repo_dir DONE ====" +} + +UPSTREAM_BASE=${TUNASYNC_UPSTREAM_URL:-"https://github.com/CocoaPods"} +REPOS=("Specs") + +for repo in ${REPOS[@]}; do + if [[ ! -d "$TUNASYNC_WORKING_DIR/${repo}.git" ]]; then + echo "Initializing ${repo}.git" + repo_init "${UPSTREAM_BASE}/${repo}.git" "$TUNASYNC_WORKING_DIR/${repo}.git" + fi + update_cocoapods_git "$TUNASYNC_WORKING_DIR/${repo}.git" +done