|
49 | 49 | stack_devfile=$stack_root/devfile.yaml |
50 | 50 | # Read version list for stack |
51 | 51 | read -r -a versions <<< "$(ls ${STACKS_DIR}/${stack} | grep -e '[0-9].[0-9].[0-9]' | tr '\n' ' ')" |
| 52 | + # If multi version stack |
52 | 53 | if [[ ${#versions[@]} -gt 0 ]] |
53 | 54 | then |
54 | 55 | for version in ${versions[@]} |
55 | 56 | do |
56 | 57 | stack_root=$STACKS_DIR/$stack/$version |
57 | 58 | stack_devfile=$stack_root/devfile.yaml |
| 59 | + # If the specified starter project is found |
58 | 60 | if [ ! -z "$(yq e ".starterProjects[] | select(.name == \"${starter_project}\")" $stack_devfile)" ] |
59 | 61 | then |
| 62 | + # Starter project has a git remote |
60 | 63 | if [ "$(yq e ".starterProjects[] | select(.name == \"${starter_project}\").git" $stack_devfile)" != "null" ] |
61 | 64 | then |
62 | 65 | echo "Downloading ${starter_project} starter project in stack ${stack} version ${version}.." |
63 | 66 | download_git_starter_project $stack_root $starter_project |
64 | 67 | echo "Downloading ${starter_project} starter project in stack ${stack} version ${version}..done!" |
| 68 | + # Starter project has a zip remote |
65 | 69 | elif [ "$(yq e ".starterProjects[] | select(.name == \"${starter_project}\").zip" $stack_devfile)" != "null" ] |
66 | 70 | then |
67 | 71 | echo "Downloading ${starter_project} starter project in stack ${stack} version ${version}.." |
|
70 | 74 | fi |
71 | 75 | fi |
72 | 76 | done |
| 77 | + # If not multi version stack & the specified starter project is found |
73 | 78 | elif [ ! -z "$(yq e ".starterProjects[] | select(.name == \"${starter_project}\")" $stack_devfile)" ] |
74 | 79 | then |
| 80 | + # Starter project has a git remote |
75 | 81 | if [ "$(yq e ".starterProjects[] | select(.name == \"${starter_project}\").git" $stack_devfile)" != "null" ] |
76 | 82 | then |
77 | 83 | echo "Downloading ${starter_project} starter project in stack ${stack}.." |
78 | 84 | download_git_starter_project $stack_root $starter_project |
79 | 85 | echo "Downloading ${starter_project} starter project in stack ${stack}..done!" |
| 86 | + # Starter project has a zip remote |
80 | 87 | elif [ "$(yq e ".starterProjects[] | select(.name == \"${starter_project}\").zip" $stack_devfile)" != "null" ] |
81 | 88 | then |
82 | 89 | echo "Downloading ${starter_project} starter project in stack ${stack}.." |
|
0 commit comments