From 949c361026c3c7058cbe4672fd5ad4b2cf7958eb Mon Sep 17 00:00:00 2001 From: perry Date: Tue, 15 Mar 2016 17:36:59 -0500 Subject: [PATCH] trying to cache Circle CI's checkout of ionic-site --- circle.yml | 8 ++++++- scripts/docs/prepare.sh | 33 ++++++++++++++++++++++++++ scripts/docs/update_docs.sh | 13 +++++----- scripts/git/clone.sh | 2 +- scripts/{utils.sh.inc => utils.inc.sh} | 0 5 files changed, 47 insertions(+), 9 deletions(-) create mode 100755 scripts/docs/prepare.sh rename scripts/{utils.sh.inc => utils.inc.sh} (100%) diff --git a/circle.yml b/circle.yml index d3a69c87d..861353cb3 100644 --- a/circle.yml +++ b/circle.yml @@ -8,7 +8,13 @@ general: branches: only: - master # ignore PRs and branches - + +dependencies: + pre: + - ./scripts/docs/prepare.sh + cache_directories: + - "~/ionic-site" # cache ionic-site + test: override: - echo "No tests are written at the moment. But we will attempt to build the library with the latest changes." diff --git a/scripts/docs/prepare.sh b/scripts/docs/prepare.sh new file mode 100755 index 000000000..5300127af --- /dev/null +++ b/scripts/docs/prepare.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +echo "##### " +echo "##### prepare.sh" +echo "#####" + + +function init { + cd .. + SITE_PATH=$(readJsonProp "config.json" "sitePath") + cd .. + export IONIC_DIR=$PWD + SITE_DIR=$IONIC_DIR/$SITE_PATH +} + +function run { + + if [ ! -d "$SITE_DIR" ]; then + echo "checking out" + cd ./scripts + ./git/clone.sh --repository="driftyco/ionic-site" \ + --directory="$SITE_DIR" \ + --branch="master" + ls -al $SITE_DIR + else + echo "using existing" + cd $SITE_DIR + git reset --hard + git pull origin master + fi +} + +source $(dirname $0)/../utils.inc.sh diff --git a/scripts/docs/update_docs.sh b/scripts/docs/update_docs.sh index 9ad1ab6ca..b87868f90 100755 --- a/scripts/docs/update_docs.sh +++ b/scripts/docs/update_docs.sh @@ -14,12 +14,11 @@ function init { } function run { - ls -al - cd ./scripts - ./git/clone.sh --repository="driftyco/ionic-site" \ - --directory="$SITE_DIR" \ - --branch="master" - cd .. + + cd $SITE_DIR + git reset --hard + git pull origin master + VERSION=$(readJsonProp "package.json" "version") # process new docs @@ -45,4 +44,4 @@ function run { fi } -source $(dirname $0)/../utils.sh.inc +source $(dirname $0)/../utils.inc.sh diff --git a/scripts/git/clone.sh b/scripts/git/clone.sh index d44949c1b..dd29fe56a 100755 --- a/scripts/git/clone.sh +++ b/scripts/git/clone.sh @@ -23,4 +23,4 @@ function run { cd ../ } -source $(dirname $0)/../utils.sh.inc +source $(dirname $0)/../utils.inc.sh diff --git a/scripts/utils.sh.inc b/scripts/utils.inc.sh similarity index 100% rename from scripts/utils.sh.inc rename to scripts/utils.inc.sh