Created
February 1, 2018 16:10
-
-
Save Chaircrusher/60e7b2f73d6c10236196d408ef76f636 to your computer and use it in GitHub Desktop.
Script to parse VCV Rack community plugin JSON files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# check for the community repo locally | |
if [ -d "community" ]; then | |
pushd community | |
# discard any changes | |
git reset HEAD --hard | |
# update the community repo if it exists | |
git pull | |
popd | |
else | |
# community repo does not exist so pull it down | |
git clone https://github.com/VCVRack/community | |
fi | |
# check for the canonical list of tags | |
declare -a tags=( "slug" | |
"name" | |
"author" | |
"license" | |
"version" | |
"homepage" | |
"donation" | |
"manual" | |
"source" | |
"downloads" | |
"win" | |
"lin" | |
"mac" | |
) | |
# look at each plugin json file | |
for x in community/plugins/*.json | |
do | |
# only print something if at least one tag is missing. | |
first=1 | |
for y in "${tags[@]}" | |
do | |
# if grep for a tag fails, report | |
if ! grep --quiet "${y}" "${x}" | |
then | |
# print plugin name once | |
if [ "${first}" -eq 1 ] | |
then | |
# print the plugin name, no newline | |
echo -n "$(basename "${x%.*}"): Missing" | |
# only do it once | |
first=0 | |
fi | |
# print the missing tag | |
echo -n " ${y}" | |
fi | |
done | |
# if there were any missing tags, print a newline | |
if [ "${first}" -eq "0" ] | |
then | |
printf "\n" | |
else | |
echo "$(basename "${x%.*}"): All tags present." | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment