Skip to content

Commit

Permalink
Allow samples cache directory to be created if non-existent (#239)
Browse files Browse the repository at this point in the history
* allow samplesDir to be created if non-existent

Signed-off-by: Michael Valdron <mvaldron@redhat.com>

* address darwin relative path handling

Signed-off-by: Michael Valdron <mvaldron@redhat.com>

* Update build-tools/cache_samples.sh

Co-authored-by: Jordan Dubrick <jdubrick@redhat.com>
Signed-off-by: Michael Valdron <mvaldron@redhat.com>

---------

Signed-off-by: Michael Valdron <mvaldron@redhat.com>
Co-authored-by: Jordan Dubrick <jdubrick@redhat.com>
  • Loading branch information
michael-valdron and Jdubrick authored May 15, 2024
1 parent f77b0bf commit 1e05c6f
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions build-tools/cache_samples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,27 @@ function cache_devfile() {
fi
}

devfileEntriesFile=$1
samplesDir=$2
if [[ "$OSTYPE" == "darwin"* ]]
then
if [[ $1 != ./* ]] && [[ $1 != ../* ]] && [[ $1 != /* ]]
then
devfileEntriesFile=./$1
else
devfileEntriesFile=$1
fi
if [[ $2 != ./* ]] && [[ $2 != ../* ]] && [[ $2 != /* ]]
then
samplesDir=./$2
else
samplesDir=$2
fi
else
devfileEntriesFile=$1
samplesDir=$2
fi

for sample in $(yq e '(.samples[].name)' $devfileEntriesFile); do
mkdir $samplesDir/$sample
mkdir -p $samplesDir/$sample
echo $sample
cache_sample $sample $samplesDir/$sample
done

0 comments on commit 1e05c6f

Please sign in to comment.