Add support for direct building of a URL

This allows for things like: (to build test a PR branch directly)
```console
$ ./build.sh https://raw.githubusercontent.com/infosiftr/stackbrew/redis/library/redis
```

Or: (to build test just one tag of a PR branch)
```console
$ ./build.sh https://raw.githubusercontent.com/infosiftr/stackbrew/redis/library/redis:2.6
```
This commit is contained in:
Tianon Gravi 2014-10-01 11:29:30 -06:00
parent ea51941ed4
commit ad38f3333a
1 changed files with 26 additions and 8 deletions

View File

@ -112,17 +112,35 @@ for repoTag in "${repos[@]}"; do
tag="${repoTag#*:}"
[ "$repo" != "$tag" ] || tag=
if [ -f "$repo" ]; then
repoFile="$repo"
repo="$(basename "$repoFile")"
if [ "$repo" = 'http' -o "$repo" = 'https' ] && [[ "$tag" == //* ]]; then
# IT'S A URL!
repoUrl="$repo:${tag%:*}"
repo="$(basename "$repoUrl")"
if [ "${tag##*:}" != "$tag" ]; then
tag="${tag##*:}"
else
tag=
fi
repoTag="${repo}${tag:+:$tag}"
echo "$repoTag ($repoUrl)" >> "$logDir/repos.txt"
cmd=( curl -sSL --compressed "$repoUrl" )
else
repoFile="$library/$repo"
if [ -f "$repo" ]; then
repoFile="$repo"
repo="$(basename "$repoFile")"
repoTag="${repo}${tag:+:$tag}"
else
repoFile="$library/$repo"
fi
repoFile="$(readlink -f "$repoFile")"
echo "$repoTag ($repoFile)" >> "$logDir/repos.txt"
cmd=( cat "$repoFile" )
fi
repoFile="$(readlink -f "$repoFile")"
echo "$repoTag ($repoFile)" >> "$logDir/repos.txt"
if [ "${repoGitRepo[$repoTag]}" ]; then
queue+=( "$repoTag" )
continue
@ -130,7 +148,7 @@ for repoTag in "${repos[@]}"; do
# parse the repo library file
IFS=$'\n'
repoTagLines=( $(cat "$repoFile" | grep -vE '^#|^\s*$') )
repoTagLines=( $("${cmd[@]}" | grep -vE '^#|^\s*$') )
unset IFS
tags=()