Skip to content

Instantly share code, notes, and snippets.

@afragen
Last active May 26, 2017 22:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afragen/549cc092a1f61c2a8d7c to your computer and use it in GitHub Desktop.
Save afragen/549cc092a1f61c2a8d7c to your computer and use it in GitHub Desktop.
A Customfile for VVV to auto-create synced folders for specific VVV site and bash file to convert shared folder to symlinks.
# -*- mode: ruby -*-
# vi: set ft=ruby :
config.vm.provider :virtualbox do |v|
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
#v.memory = 2048
end
# config.vm.synced_folder "/Users/afragen/Documents/github/github-updater", "/srv/www/test3/htdocs/wp-content/plugins/github-updater", :owner => "www-data", :mount_options => [ "dmode=775", "fmode=774" ]
vvvsites = [
'multi-test',
'single-test',
]
git_plugins = [
'add-custom-header-images',
'airplane-mode',
'category-colors-options',
'drmc-medical-staff-governance',
'embed-pdf-viewer',
'github-updater',
'github-updater-additions',
'local-development',
'losrobles-governance',
'pods',
'resend-welcome-email',
'the-events-calendar-category-colors',
'the-events-calendar-pro-alarm',
'the-events-calendar-user-css',
'wp-install-dependencies',
'wp-polls',
]
git_themes = [
'losrobles-theme',
]
localgit = '/Users/afragen/Documents/github/'
localvagrant = '/Users/afragen/vagrant-local/www/'
vvvsites.each do |site|
git_repos = {}
plugins_path = '/srv/www/' + site + '/htdocs/wp-content/plugins/'
themes_path = '/srv/www/' + site + '/htdocs/wp-content/themes/'
git_plugins.each do |plugin|
git_repos.merge!( localgit + plugin => plugins_path + plugin )
end
git_themes.each do |theme|
git_repos.merge!( localgit + theme => themes_path + theme )
end
git_repos.each do |local, vvv|
config.vm.synced_folder local, vvv, :owner => 'www-data', :mount_options => [ 'dmode=775', 'fmode=774' ]
end
end
# Remove all synched folders at startup.
# This seems to run first.
# Unfortunately also runs with `vagrant ssh`, etc.
vvvsites.each do |site|
plugins_localpath = localvagrant + site + '/htdocs/wp-content/plugins/'
themes_localpath = localvagrant + site + '/htdocs/wp-content/themes/'
vagrant_shared_folders = []
git_plugins.each do |plugin|
vagrant_shared_folders.push( plugins_localpath + plugin )
end
git_themes.each do |theme|
vagrant_shared_folders.push( themes_localpath + theme )
end
vagrant_shared_folders.each do |folder|
if File.symlink?( folder )
%x[rm -r #{folder}]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment