|
3 | 3 | # Fetch material2 assets from material2-docs-content repo.
|
4 | 4 |
|
5 | 5 |
|
6 |
| -ASSETS_DOCS_PATH=./src/assets/documents/ |
7 |
| -ASSETS_EXAMPLES_PATH=./src/assets/examples/ |
8 |
| -DEST_PATH=/tmp/material-assets |
9 |
| -DOCS_REPO=https://github.com/DevVersion/material2-docs-content |
10 |
| -DOCS_API_PATH=$DEST_PATH/api |
11 |
| -DOCS_GUIDES_PATH=$DEST_PATH/guides |
12 |
| -DOCS_OVERVIEW_PATH=$DEST_PATH/overview |
13 |
| -DOCS_EXAMPLES_PATH=$DEST_PATH/examples/ |
14 |
| - |
15 |
| -# create folder structure |
16 |
| -if [ ! -d $DEST_PATH ]; then |
17 |
| - mkdir -p $DEST_PATH |
18 |
| -fi |
19 |
| - |
20 |
| -if [ ! -d $ASSETS_EXAMPLES_PATH ]; then |
21 |
| - mkdir -p $ASSETS_EXAMPLES_PATH $ASSETS_DOCS_PATH |
22 |
| -fi |
| 6 | +# Dir where documentation assets will be copied (overviews, api docs) |
| 7 | +docAssetsPath=./src/assets/documents/ |
| 8 | + |
| 9 | +# Dir where live-example assets will be copied |
| 10 | +exampleAssetsPath=./src/assets/examples/ |
| 11 | + |
| 12 | +# Dir where published assets will temporarily copied to (using `git clone`). |
| 13 | +tmpAssetClonePath=/tmp/material-assets |
| 14 | + |
| 15 | +# GitHub repo which contains snapshots of the docs content from angular/material2. |
| 16 | +docsContentRepo=https://github.com/angular/material2-docs-content |
| 17 | + |
| 18 | +# Dirs for each of api docs, guides, overviews, and live-examples within the |
| 19 | +# cloned content repo. |
| 20 | +apiPath=$tmpAssetClonePath/api |
| 21 | +guidesPath=$tmpAssetClonePath/guides |
| 22 | +overviewPath=$tmpAssetClonePath/overview |
| 23 | +examplesPath=$tmpAssetClonePath/examples/ |
| 24 | + |
| 25 | +# Create folders into which to copy content and assets. |
| 26 | +mkdir -p $tmpAssetClonePath |
| 27 | +mkdir -p $exampleAssetsPath $docAssetsPath |
23 | 28 |
|
24 | 29 | # Pull assets from repo and remove .git directory
|
25 |
| -git clone $DOCS_REPO $DEST_PATH |
26 |
| -rm -rf $DEST_PATH/.git |
| 30 | +git clone $docsContentRepo $tmpAssetClonePath |
27 | 31 |
|
28 | 32 | # Copy files over to their proper place in src/assets
|
29 |
| -cp -r $DOCS_API_PATH $DOCS_OVERVIEW_PATH $DOCS_GUIDES_PATH $ASSETS_DOCS_PATH |
30 |
| -cp -r $DOCS_EXAMPLES_PATH $ASSETS_EXAMPLES_PATH |
| 33 | +cp -r $apiPath $overviewPath $guidesPath $docAssetsPath |
| 34 | +cp -r $examplesPath $exampleAssetsPath |
31 | 35 |
|
32 | 36 | # Remove temporary directory
|
33 |
| -rm -rf $DEST_PATH |
| 37 | +rm -rf $tmpAssetClonePath |
0 commit comments