-
-
Save mauriciodulce/02a8702969450b2e017bb06d0a3f696f to your computer and use it in GitHub Desktop.
For use with Local by Flywheel (Pressmatic) Volumes Addon to create symlinks for better IDE integration
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 | |
# Usage: | |
# | |
# local-symlink.sh sitename -- add symlinks | |
# | |
# The value for sitename must match the folder you have for the site. | |
# | |
# Requires Local by Flywheel Volumes Add-on | |
# https://github.com/getflywheel/local-addon-volumes | |
# | |
# You MUST add each item in your plugins, mu_plugins, and themes in as a local addon path. | |
# Yes it sucks | |
# | |
# Thanks Ipstenu! | |
# case patterns are sitename(s) | |
case "$1" in | |
single-test ) | |
plugins=( | |
'github/add-custom-header-images' | |
'github/embed-pdf-viewer' | |
'github/github-updater' | |
'github/github-updater-additions' | |
'github/http-debug-info' | |
'github/local-development' | |
'github/the-events-calendar-category-colors' | |
'github/title-capitalization-for-wordpress' | |
'github/test-wcphx' | |
) | |
themes=() | |
mu_plugins=() | |
;; | |
* ) | |
echo "There is no site named '$1' to sync." | |
exit 1 | |
;; | |
esac | |
# Change these to your setup. | |
# By default, Local is installed in /Users/YOURNAME/Local Site | |
devsource="/Users/afragen/Documents" | |
local_path="/Users/afragen/Local Sites" | |
# You probably won't need to change these, unless WP is in a subfolder | |
docker_plugin_path="app/public/wp-content/plugins" | |
docker_mu_plugin_path="app/public/wp-content/mu_plugins" | |
docker_theme_path="app/public/wp-content/themes" | |
# Do not edit below this line | |
devsites=( $1 ) | |
for site in ${devsites[@]}; do | |
# Copy Plugins | |
for plugin in ${plugins[@]}; do | |
# if not symlink exists, force make symlink | |
if [[ ! -h "$local_path"/${site}/$docker_plugin_path/${plugin##*/} ]]; then | |
ln -sF $devsource/${plugin} "$local_path"/${site}/$docker_plugin_path | |
echo ${plugin##*/} 'symlink created' | |
fi | |
done | |
# Copy Themes | |
for theme in ${themes[@]}; do | |
# if not symlink exists, force make symlink | |
if [[ ! -h "$local_path"/${site}/$docker_theme_path/${theme##*/} ]]; then | |
ln -sF $devsource/${theme} "$local_path"/${site}/$docker_theme_path | |
echo ${theme##*/} 'symlink created' | |
fi | |
done | |
# Copy MU Plugins | |
for mu_plugin in ${mu_plugins[@]}; do | |
# if not symlink exists, force make symlink | |
if [[ ! -h "$local_path"/${site}/$docker_mu_plugin_path/${mu_plugin##*/} ]]; then | |
ln -sF $devsource/${mu_plugin} "$local_path"/${site}/$docker_mu_plugin_path | |
echo ${mu_plugin##*/} 'mu_plugin symlink created' | |
fi | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment