Skip to content

Commit

Permalink
Mount ~/.chassis/extensions at /vagrant/extensions/_global
Browse files Browse the repository at this point in the history
  • Loading branch information
rmccue committed Sep 9, 2018
1 parent a1212e1 commit e1dbba3
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Vagrantfile
Expand Up @@ -35,6 +35,19 @@ module_paths.concat Dir.glob( base_path.to_s + "/extensions/*/modules" )
# Convert to relative from Vagrantfile
module_paths = Chassis.make_relative(base_path, module_paths)

# Add global extensions, if they exist
global_ext_path = File.join(Dir.home, ".chassis", "extensions")
use_global_ext = Dir.exist?(global_ext_path) && ! Dir.empty?(global_ext_path)
if use_global_ext
global_ext_modules = Dir.glob(global_ext_path + "/*/modules")
global_ext_modules.delete_if { |path|
ext_name = path.split("/")[-2]
# Search for the ext_name in the regular extensions
module_paths.include?("extensions/" + ext_name + "/modules")
}
global_ext_modules = Chassis.make_relative(global_ext_path, global_ext_modules)
end

Vagrant.configure("2") do |config|
# Set up potential providers.
config.vm.provider "virtualbox" do |vb|
Expand Down Expand Up @@ -84,6 +97,10 @@ Vagrant.configure("2") do |config|
## puppet.module_path = module_paths
# Workaround:
machine_rel_module_paths = module_paths.map { |rel_path| "/vagrant/" + rel_path }
if use_global_ext
prefixed_global = global_ext_modules.map { |rel_path| "/vagrant/extensions/_global/" + rel_path }
machine_rel_module_paths.concat prefixed_global
end
puppet.options = "--modulepath " + machine_rel_module_paths.join( ':' ).inspect

# Disable Hiera configuration file
Expand Down Expand Up @@ -114,6 +131,10 @@ Vagrant.configure("2") do |config|
synced_folders = CONF["synced_folders"].clone
synced_folders["."] = "/vagrant"

if use_global_ext
synced_folders[global_ext_path] = "/vagrant/extensions/_global"
end

# Ensure that WordPress can install/update plugins, themes and core
mount_opts = CONF['nfs'] ? [] : ["dmode=777","fmode=777"]

Expand Down

0 comments on commit e1dbba3

Please sign in to comment.