hack/update-external-examples.sh
8eb43c15
 #!/bin/bash
 
df353fcc
 # 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.
614bf6cc
 source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
8eb43c15
 
df353fcc
 # For now the only external examples are in examples/quickstarts.
8eb43c15
 QUICKSTARTS_DIR="${OS_ROOT}/examples/quickstarts"
 (
   cd "${QUICKSTARTS_DIR}"
 
   rm -vf *.{json,yaml,yml}
 
   # 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/')
 )