angular-docs-cn/scripts/cache.sh

96 lines
2.4 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -e -o pipefail
cd `dirname $0`/..
BASE="public/docs/ts"
LATEST="$BASE/latest"
CACHE="$BASE/_cache"
Merge remote-tracking branch 'angular.io/master' # Conflicts: # .travis.yml # public/_includes/_footer.jade # public/_includes/_hero-home.jade # public/_includes/_next-item.jade # public/_includes/_util-fns.jade # public/_includes/_version-dropdown.jade # public/docs/_examples/package.json # public/docs/_examples/quickstart/dart/lib/app_component.dart # public/docs/_examples/quickstart/e2e-spec.ts # public/docs/_examples/quickstart/js/app/app.component.js # public/docs/_examples/quickstart/ts/app/app.component.ts # public/docs/_examples/quickstart/ts/index.html # public/docs/_examples/toh-5/dart/lib/dashboard_component.html # public/docs/_examples/toh-5/dart/lib/hero_detail_component.dart # public/docs/dart/latest/_util-fns.jade # public/docs/dart/latest/guide/_data.json # public/docs/dart/latest/guide/index.jade # public/docs/dart/latest/quickstart.jade # public/docs/index.jade # public/docs/js/latest/quickstart.jade # public/docs/ts/_cache/glossary.jade # public/docs/ts/_cache/guide/dependency-injection.jade # public/docs/ts/_cache/guide/index.jade # public/docs/ts/_cache/quickstart.jade # public/docs/ts/_cache/tutorial/toh-pt5.jade # public/docs/ts/latest/_data.json # public/docs/ts/latest/_quickstart_repo.jade # public/docs/ts/latest/cli-quickstart.jade # public/docs/ts/latest/cookbook/_data.json # public/docs/ts/latest/cookbook/a1-a2-quick-reference.jade # public/docs/ts/latest/cookbook/aot-compiler.jade # public/docs/ts/latest/cookbook/dynamic-form.jade # public/docs/ts/latest/glossary.jade # public/docs/ts/latest/guide/_data.json # public/docs/ts/latest/guide/architecture.jade # public/docs/ts/latest/guide/attribute-directives.jade # public/docs/ts/latest/guide/browser-support.jade # public/docs/ts/latest/guide/change-log.jade # public/docs/ts/latest/guide/dependency-injection.jade # public/docs/ts/latest/guide/displaying-data.jade # public/docs/ts/latest/guide/forms.jade # public/docs/ts/latest/guide/index.jade # public/docs/ts/latest/guide/lifecycle-hooks.jade # public/docs/ts/latest/guide/ngmodule.jade # public/docs/ts/latest/guide/npm-packages.jade # public/docs/ts/latest/guide/router.jade # public/docs/ts/latest/guide/server-communication.jade # public/docs/ts/latest/guide/style-guide.jade # public/docs/ts/latest/guide/template-syntax.jade # public/docs/ts/latest/guide/testing.jade # public/docs/ts/latest/guide/typescript-configuration.jade # public/docs/ts/latest/guide/upgrade.jade # public/docs/ts/latest/guide/user-input.jade # public/docs/ts/latest/quickstart.jade # public/docs/ts/latest/tutorial/_data.json # public/docs/ts/latest/tutorial/index.jade # public/docs/ts/latest/tutorial/toh-pt1.jade # public/docs/ts/latest/tutorial/toh-pt3.jade # public/docs/ts/latest/tutorial/toh-pt5.jade # public/docs/ts/latest/tutorial/toh-pt6.jade # public/events.jade # public/resources/images/devguide/quickstart/hello-angular.png # scripts/cache.sh # tools/plunker-builder/indexHtmlTranslator.js
2016-11-26 16:43:16 -05:00
# setup-systemjs-anatomy.jade?
FILES="
guide/architecture.jade
guide/attribute-directives.jade
guide/component-styles.jade
guide/dependency-injection.jade
guide/displaying-data.jade
guide/hierarchical-dependency-injection.jade
2016-11-22 07:07:16 -05:00
guide/index.jade
Merge remote-tracking branch 'angular.io/master' # Conflicts: # .travis.yml # public/_includes/_footer.jade # public/_includes/_hero-home.jade # public/_includes/_next-item.jade # public/_includes/_util-fns.jade # public/_includes/_version-dropdown.jade # public/docs/_examples/package.json # public/docs/_examples/quickstart/dart/lib/app_component.dart # public/docs/_examples/quickstart/e2e-spec.ts # public/docs/_examples/quickstart/js/app/app.component.js # public/docs/_examples/quickstart/ts/app/app.component.ts # public/docs/_examples/quickstart/ts/index.html # public/docs/_examples/toh-5/dart/lib/dashboard_component.html # public/docs/_examples/toh-5/dart/lib/hero_detail_component.dart # public/docs/dart/latest/_util-fns.jade # public/docs/dart/latest/guide/_data.json # public/docs/dart/latest/guide/index.jade # public/docs/dart/latest/quickstart.jade # public/docs/index.jade # public/docs/js/latest/quickstart.jade # public/docs/ts/_cache/glossary.jade # public/docs/ts/_cache/guide/dependency-injection.jade # public/docs/ts/_cache/guide/index.jade # public/docs/ts/_cache/quickstart.jade # public/docs/ts/_cache/tutorial/toh-pt5.jade # public/docs/ts/latest/_data.json # public/docs/ts/latest/_quickstart_repo.jade # public/docs/ts/latest/cli-quickstart.jade # public/docs/ts/latest/cookbook/_data.json # public/docs/ts/latest/cookbook/a1-a2-quick-reference.jade # public/docs/ts/latest/cookbook/aot-compiler.jade # public/docs/ts/latest/cookbook/dynamic-form.jade # public/docs/ts/latest/glossary.jade # public/docs/ts/latest/guide/_data.json # public/docs/ts/latest/guide/architecture.jade # public/docs/ts/latest/guide/attribute-directives.jade # public/docs/ts/latest/guide/browser-support.jade # public/docs/ts/latest/guide/change-log.jade # public/docs/ts/latest/guide/dependency-injection.jade # public/docs/ts/latest/guide/displaying-data.jade # public/docs/ts/latest/guide/forms.jade # public/docs/ts/latest/guide/index.jade # public/docs/ts/latest/guide/lifecycle-hooks.jade # public/docs/ts/latest/guide/ngmodule.jade # public/docs/ts/latest/guide/npm-packages.jade # public/docs/ts/latest/guide/router.jade # public/docs/ts/latest/guide/server-communication.jade # public/docs/ts/latest/guide/style-guide.jade # public/docs/ts/latest/guide/template-syntax.jade # public/docs/ts/latest/guide/testing.jade # public/docs/ts/latest/guide/typescript-configuration.jade # public/docs/ts/latest/guide/upgrade.jade # public/docs/ts/latest/guide/user-input.jade # public/docs/ts/latest/quickstart.jade # public/docs/ts/latest/tutorial/_data.json # public/docs/ts/latest/tutorial/index.jade # public/docs/ts/latest/tutorial/toh-pt1.jade # public/docs/ts/latest/tutorial/toh-pt3.jade # public/docs/ts/latest/tutorial/toh-pt5.jade # public/docs/ts/latest/tutorial/toh-pt6.jade # public/events.jade # public/resources/images/devguide/quickstart/hello-angular.png # scripts/cache.sh # tools/plunker-builder/indexHtmlTranslator.js
2016-11-26 16:43:16 -05:00
guide/learning-angular.jade
guide/lifecycle-hooks.jade
guide/pipes.jade
guide/security.jade
guide/server-communication.jade
Merge remote-tracking branch 'angular.io/master' # Conflicts: # .travis.yml # public/_includes/_footer.jade # public/_includes/_hero-home.jade # public/_includes/_next-item.jade # public/_includes/_util-fns.jade # public/_includes/_version-dropdown.jade # public/docs/_examples/package.json # public/docs/_examples/quickstart/dart/lib/app_component.dart # public/docs/_examples/quickstart/e2e-spec.ts # public/docs/_examples/quickstart/js/app/app.component.js # public/docs/_examples/quickstart/ts/app/app.component.ts # public/docs/_examples/quickstart/ts/index.html # public/docs/_examples/toh-5/dart/lib/dashboard_component.html # public/docs/_examples/toh-5/dart/lib/hero_detail_component.dart # public/docs/dart/latest/_util-fns.jade # public/docs/dart/latest/guide/_data.json # public/docs/dart/latest/guide/index.jade # public/docs/dart/latest/quickstart.jade # public/docs/index.jade # public/docs/js/latest/quickstart.jade # public/docs/ts/_cache/glossary.jade # public/docs/ts/_cache/guide/dependency-injection.jade # public/docs/ts/_cache/guide/index.jade # public/docs/ts/_cache/quickstart.jade # public/docs/ts/_cache/tutorial/toh-pt5.jade # public/docs/ts/latest/_data.json # public/docs/ts/latest/_quickstart_repo.jade # public/docs/ts/latest/cli-quickstart.jade # public/docs/ts/latest/cookbook/_data.json # public/docs/ts/latest/cookbook/a1-a2-quick-reference.jade # public/docs/ts/latest/cookbook/aot-compiler.jade # public/docs/ts/latest/cookbook/dynamic-form.jade # public/docs/ts/latest/glossary.jade # public/docs/ts/latest/guide/_data.json # public/docs/ts/latest/guide/architecture.jade # public/docs/ts/latest/guide/attribute-directives.jade # public/docs/ts/latest/guide/browser-support.jade # public/docs/ts/latest/guide/change-log.jade # public/docs/ts/latest/guide/dependency-injection.jade # public/docs/ts/latest/guide/displaying-data.jade # public/docs/ts/latest/guide/forms.jade # public/docs/ts/latest/guide/index.jade # public/docs/ts/latest/guide/lifecycle-hooks.jade # public/docs/ts/latest/guide/ngmodule.jade # public/docs/ts/latest/guide/npm-packages.jade # public/docs/ts/latest/guide/router.jade # public/docs/ts/latest/guide/server-communication.jade # public/docs/ts/latest/guide/style-guide.jade # public/docs/ts/latest/guide/template-syntax.jade # public/docs/ts/latest/guide/testing.jade # public/docs/ts/latest/guide/typescript-configuration.jade # public/docs/ts/latest/guide/upgrade.jade # public/docs/ts/latest/guide/user-input.jade # public/docs/ts/latest/quickstart.jade # public/docs/ts/latest/tutorial/_data.json # public/docs/ts/latest/tutorial/index.jade # public/docs/ts/latest/tutorial/toh-pt1.jade # public/docs/ts/latest/tutorial/toh-pt3.jade # public/docs/ts/latest/tutorial/toh-pt5.jade # public/docs/ts/latest/tutorial/toh-pt6.jade # public/events.jade # public/resources/images/devguide/quickstart/hello-angular.png # scripts/cache.sh # tools/plunker-builder/indexHtmlTranslator.js
2016-11-26 16:43:16 -05:00
guide/setup.jade
guide/structural-directives.jade
guide/template-syntax.jade
2016-08-12 14:14:44 -04:00
glossary.jade
quickstart.jade
2016-11-22 07:07:16 -05:00
_quickstart_repo.jade
tutorial/index.jade
tutorial/toh-pt5.jade
tutorial/toh-pt6.jade"
function cacheRefresh() {
local FILE_PATTERN="*"
if [[ -n "$1" ]]; then
FILE_PATTERN="$1"
else
echo "Argument missing: specify shell file glob pattern of files to be refreshed."
exit 1;
fi
local allFound=true;
for f in $FILES; do
local srcPath="$LATEST/$f";
local destPath="$CACHE/$f";
local destDir=`dirname $destPath`;
if [[ -e $srcPath ]]; then
[[ -d "$destDir" ]] || (set -x; mkdir $destDir);
case "$f" in
(*$FILE_PATTERN*)
(set -x; cp $srcPath $destPath);;
(*)
echo "SKIPPED $f";;
esac
else
echo Cannot find $srcPath
allFound=false;
fi
done
[[ $allFound ]] || exit 1;
}
function cacheDiffSummary() {
2016-11-22 07:07:16 -05:00
diff -qr -x "_util*.jade" "$CACHE/" "$LATEST/" | \
grep -v "^Only in"
}
function cacheDiff() {
local FILES="*$1*"
cd $CACHE;
# List files
find . -name "$FILES" ! -name "*~" -exec diff -q {} ../latest/{} \;
# Show differences
find . -name "$FILES" ! -name "*~" -exec diff {} ../latest/{} \;
}
function usage() {
echo "Usage: cache.sh [options]"
echo " (-ds|--diff-summary) list names of cache files that differ from ts/latest"
echo " (-d|--diff) pat diff cache and latest subdirectories"
echo " (-l|--list) list files subject to caching"
echo " (-r|--refresh) pat refresh files in cache matching pattern"
}
case "$1" in
(-ds|--diff-summary) shift; cacheDiffSummary $@;;
(-d|--diff) shift; cacheDiff $@;;
(-l|--list) shift; printf "$FILES\n\n";;
(-r|--refresh) shift; cacheRefresh $@;;
(*) usage;
esac