Skip to content

Instantly share code, notes, and snippets.

@jeremywen
Last active January 30, 2018 15:08
Show Gist options
  • Save jeremywen/263d7d22790cebd08536be86b5968864 to your computer and use it in GitHub Desktop.
Save jeremywen/263d7d22790cebd08536be86b5968864 to your computer and use it in GitHub Desktop.
This script pulls down the VCV Rack community repo, finds source urls, pulls down source repos, and builds plugins.
#!/bin/bash
#################################################################################################################################
# community-builds-from-source.sh
# by Jeremy Wentworth
#
# This script pulls down the VCV Rack community repo, finds source urls, pulls down source repos, and builds plugins.
#
# This script requires:
# git - https://git-scm.com/
# VCV Rack dev env - https://github.com/VCVRack/Rack#setting-up-your-development-environment
#
# Copy this script into:
# Rack/plugins
#
# Run this in Rack/plugins:
# . community-builds-from-source.sh
#
#################################################################################################################################
# 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
# loop through the json in the community repo
for gitPlugin in $(cat community/plugins/*.json | grep \"source\" | awk -F'"' '{print $4}')
do
# get the folder name and see if we already haave it locally
pluginDirName=$(echo $gitPlugin | awk -F'/' '{print $5}')
if [ -d "$pluginDirName" ]; then
echo "$pluginDirName exists"
else
echo "$pluginDirName does not exists yet"
userNameUrlPart=$(echo $gitPlugin | awk -F'/' '{print $4}')
git clone $gitPlugin #NOTE: not all plugins are on github, sonus is on gitlab
fi
# change to the repo dir
pushd $pluginDirName
# Some devs don't have a .gitignore so you can't pull until you do something with the changed files.
git reset HEAD --hard #discards any changes - we could do `git stash` here instead
# pull down the latest code
git pull
# try to update submodules if there are any
git submodule update --init --recursive
# clean old builds (might not be needed but can prevent issues)
make clean
# finally, build the plugin
make
# go back to the last dir
popd
done
@Chaircrusher
Copy link

Sure@Phal-anx -- my understanding of how this all works is evolving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment