summaryrefslogtreecommitdiff
path: root/scripts/scaffold-website.sh
blob: 92547ac888077a474bdb86ad6eea508632ec83ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash

function verifyVars {
  echo "==> Verifying required variables are set..."
  if [ "${BRAND_NAME}" == "" ]; then
    echo "\nBRAND_NAME is unset, exiting"
    exit 1
  fi
  if [ "${RESOURCE_NAME}" == "" ]; then
    echo "\nRESOURCE_NAME is unset, exiting"
    exit 1
  fi
  if [ "${RESOURCE_TYPE}" == "" ]; then
    echo "\nRESOURCE_TYPE is unset, exiting"
    exit 1
  fi
  if [ "${RESOURCE_TYPE}" == "resource" ]; then
    if [ "${RESOURCE_ID}" == "" ]; then
      echo "\nRESOURCE_ID is unset, exiting"
      exit 1
    fi
  fi

  echo "==> Validated."
}

function scaffoldDocumentation {
  echo "==> Scaffolding Documentation..."
  go run azuredevops/internal/website-scaffold/main.go -name "${RESOURCE_NAME}" -brand-name "${BRAND_NAME}" -type "${RESOURCE_TYPE}" -resource-id "${RESOURCE_ID}" -website-path ./website/
  echo "==> Done."
}

function main {
  verifyVars
  scaffoldDocumentation
}

main