Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

chore(build): add script for fetching assets locally #172 #193

Merged
merged 1 commit into from
Jun 21, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions tools/fetch-assets-local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

# Base Source Path
if [ -d ~/material2 ] ; then
echo "- Using path ~/material2"
baseSrcPath=~/material2
elif [ -d ../material2 ] ; then
echo "- Using path ../material2"
baseSrcPath=../material2
elif [ -d ${MATERIAL2_LOCAL} ] ; then
echo "- Using MATERIAL2_LOCAL env variable"
baseSrcPath = ${MATERIAL2_LOCAL}
fi

# Ensure Docs Dist
if [ ! -d ${baseSrcPath}/dist/docs ] ; then
echo "- Missing /dist/docs...Running 'gulp docs'"
( cd ${baseSrcPath} && gulp docs )
fi

# Ensure Material Examples Pkg
if [ ! -d ${baseSrcPath}/dist/releases/material-examples ] ; then
echo "- Missing material-examples...Running 'gulp material-examples:build-release'"
( cd ${baseSrcPath} && gulp material-examples:build-release)
fi

# Base Target Path
baseTargetPath=./src/assets

# Copy Packages
mkdir -p ./node_modules/@angular/material-examples
cp -r ${baseSrcPath}/dist/releases/material-examples ./node_modules/@angular/

# Copy Examples
cp -r ${baseSrcPath}/dist/docs/examples ${baseTargetPath}

# Copy API Files
cp -r ${baseSrcPath}/dist/docs/api ${baseTargetPath}/documents

# Copy Guide files
mkdir -p ./src/assets/documents/guides
cp ${baseSrcPath}/dist/docs/markdown/*.html ${baseTargetPath}/documents/guides

# Copy Overview
mkdir -p ./src/assets/documents/overview
cp ${baseSrcPath}/dist/docs/markdown/*/*.html ${baseTargetPath}/documents/overview