Skip to content

Commit

Permalink
#12 Added zip with product source files to build
Browse files Browse the repository at this point in the history
  • Loading branch information
krichardsson committed Sep 2, 2021
1 parent 41f4bfd commit 3600745
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
5 changes: 5 additions & 0 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
"source": "generated/docs.zip",
"insertTag": true,
"destination": "currDir"
},
{
"source": "generated/md.zip",
"insertTag": true,
"destination": "currDir"
}
]
}
Expand Down
17 changes: 16 additions & 1 deletion tools/build/collect
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ set -e
scriptDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
rootDir=$scriptDir/../..
docsDir=${rootDir}/generated/docs
mdDir=${rootDir}/generated/md
productsDir=src/products

# Copy all PDFs in the product tree
# Copy all PDFs in the product tree.
find ${productsDir} -type f -name "*.pdf" | while read fname
do
# Take the path "src/products/my-product/electronics/some-file-rev-c.pdf" and extract "my-product"
Expand All @@ -26,3 +27,17 @@ do
mkdir -p ${destination}
cp ${fname} ${destination}/.
done

# Copy all product source files, to be used on the web to generate product pages
find src/products -type d -name "datasheet" | while read dname
do
# dname will contain something like "src/products/sd-card-deck/datasheet", extract the "sd-card-deck" part and covert to "sd_card_deck"
tmp=${dname%/datasheet}
tmp=${tmp#src/products/}
product=${tmp//-/_}
destination=${mdDir}/${product}

mkdir -p ${destination}
echo "Copy ${dname}/* to ${destination}"
cp ${dname}/* ${destination}
done
5 changes: 5 additions & 0 deletions tools/build/compress
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ set -e
# Figure out the path for the directories
scriptDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
docsDir=${scriptDir}/../../generated/docs
mdDir=${scriptDir}/../../generated/md

echo "Compressing files..."

pushd ${docsDir}
zip -r ../docs.zip .
popd

pushd ${mdDir}
zip -r ../md.zip .
popd

0 comments on commit 3600745

Please sign in to comment.