Skip to content

Commit

Permalink
Added a routine in bin/compile to clean unused cached bundles
Browse files Browse the repository at this point in the history
(older than 30 days).
Added Tests for cache pruning.
  • Loading branch information
iphoting committed Nov 13, 2012
1 parent 4ee199d commit 31a6dff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,12 @@ shopt -s dotglob

mkdir -p $BUILD_DIR $CACHE_DIR ${BUNDLE_DIR} ${BUILD_DIR}/local ${BUILD_DIR}/vendor/bin ${COMPOSER_HOME}

echo "-----> Fetching Manifest"
pushd ${BUNDLE_DIR} > /dev/null

echo "-----> Cleaning Unused Cached Bundles"
find . -type f -atime +30 -delete | indent

echo "-----> Fetching Manifest"
curl --silent --max-time 60 -O --location $MANIFEST_URL

# Nginx
Expand Down
10 changes: 10 additions & 0 deletions test/compile_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ testCachedCompile()
assertTrue "newrelic-daemon should be executable" "[ -x ${BUILD_DIR}/local/bin/newrelic-daemon ]"
}

testCompileCachePrune()
{
mkdir -p ${CACHE_DIR}/bundles
touch -amt '197001011234' ${CACHE_DIR}/bundles/delete_me.txt
compile

assertCaptured "Cleaning Unused Cached Bundles"
assertFalse "delete_me.txt should be deleted" "[ -e ${CACHE_DIR}/bundles/delete_me.txt ]"
}

testCompileComposer()
{

Expand Down

0 comments on commit 31a6dff

Please sign in to comment.