-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add script to bulk copy generated docs files (#2337)
- Loading branch information
1 parent
e66462e
commit 0dd57da
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
# Copy docs to material docs site | ||
|
||
# Run this script after `gulp docs` | ||
# Need to specify destination folder | ||
# Use OVERVIEW.html when possible. If there's no OVERVIEW file exists, use README.html | ||
|
||
usage='Usage: copy-docs.sh $destinationFolder' | ||
if [ $# -ne 1 ]; then | ||
echo "Missing destination folder. $usage" | ||
exit | ||
fi | ||
|
||
originFolder=./dist/docs/ | ||
destFolder=$1 | ||
|
||
if [ ! -w $destFolder ]; then | ||
echo "Invalid destination folder. $usage" | ||
exit | ||
fi | ||
|
||
for file in $originFolder* | ||
do | ||
name=${file#$originFolder} | ||
overviewFile=$originFolder$name/OVERVIEW.html | ||
readmeFile=$originFolder$name/README.html | ||
destFile=$destFolder/$name.html | ||
if [ -f $overviewFile ]; then | ||
cp $overviewFile $destFile | ||
echo "Copied $overviewFile to $destFile" | ||
elif [ -f $readmeFile ]; then | ||
cp $readmeFile $destFile | ||
echo "Copied $readmeFile to $destFile" | ||
fi | ||
done |