#!/bin/sh
# This script pulls down example files (eg templates) from external repositories
# so they can be included directly in our repository.
# Feeds off a README.md file with well defined syntax that informs this
# script how to pull the file down.

# For now the only external examples are in examples/quickstarts.
pushd examples/quickstarts
rm *json
rm *yaml
# Assume the README.md file contains lines with URLs for the raw json/yaml file to be downloaded.
# Specifically look for a line containing https://raw.githubusercontent.com, then
# look for the first content in ()s on that line, which will be the actual url of the file,
# then use curl to pull that file down.
curl `grep https://raw.githubusercontent.com README.md | sed -E "s/.*\((.*)\) -.*/\\1 -O/"`
popd