From e30a2aa289d27b6f3d8b6e23b2139cfd5ccb7115 Mon Sep 17 00:00:00 2001 From: Jeremy Elbourn Date: Wed, 8 Mar 2017 15:20:34 -0800 Subject: [PATCH] Update asset fetch script to use real repo --- tools/fetch-assets.sh | 48 +++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/tools/fetch-assets.sh b/tools/fetch-assets.sh index 882af4f88..1901727e1 100755 --- a/tools/fetch-assets.sh +++ b/tools/fetch-assets.sh @@ -3,31 +3,35 @@ # Fetch material2 assets from material2-docs-content repo. -ASSETS_DOCS_PATH=./src/assets/documents/ -ASSETS_EXAMPLES_PATH=./src/assets/examples/ -DEST_PATH=/tmp/material-assets -DOCS_REPO=https://github.com/DevVersion/material2-docs-content -DOCS_API_PATH=$DEST_PATH/api -DOCS_GUIDES_PATH=$DEST_PATH/guides -DOCS_OVERVIEW_PATH=$DEST_PATH/overview -DOCS_EXAMPLES_PATH=$DEST_PATH/examples/ - -# create folder structure -if [ ! -d $DEST_PATH ]; then - mkdir -p $DEST_PATH -fi - -if [ ! -d $ASSETS_EXAMPLES_PATH ]; then - mkdir -p $ASSETS_EXAMPLES_PATH $ASSETS_DOCS_PATH -fi +# Dir where documentation assets will be copied (overviews, api docs) +docAssetsPath=./src/assets/documents/ + +# Dir where live-example assets will be copied +exampleAssetsPath=./src/assets/examples/ + +# Dir where published assets will temporarily copied to (using `git clone`). +tmpAssetClonePath=/tmp/material-assets + +# GitHub repo which contains snapshots of the docs content from angular/material2. +docsContentRepo=https://github.com/angular/material2-docs-content + +# Dirs for each of api docs, guides, overviews, and live-examples within the +# cloned content repo. +apiPath=$tmpAssetClonePath/api +guidesPath=$tmpAssetClonePath/guides +overviewPath=$tmpAssetClonePath/overview +examplesPath=$tmpAssetClonePath/examples/ + +# Create folders into which to copy content and assets. +mkdir -p $tmpAssetClonePath +mkdir -p $exampleAssetsPath $docAssetsPath # Pull assets from repo and remove .git directory -git clone $DOCS_REPO $DEST_PATH -rm -rf $DEST_PATH/.git +git clone $docsContentRepo $tmpAssetClonePath # Copy files over to their proper place in src/assets -cp -r $DOCS_API_PATH $DOCS_OVERVIEW_PATH $DOCS_GUIDES_PATH $ASSETS_DOCS_PATH -cp -r $DOCS_EXAMPLES_PATH $ASSETS_EXAMPLES_PATH +cp -r $apiPath $overviewPath $guidesPath $docAssetsPath +cp -r $examplesPath $exampleAssetsPath # Remove temporary directory -rm -rf $DEST_PATH +rm -rf $tmpAssetClonePath