Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Mar 6, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions .cakebox/Vagrantfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ def Cakebox.configure(config, user_settings)
if user_settings == false
user_settings = Hash.new
end
# Deep merge user settings found in Cakebox.yaml without plugin dependency

# Deep merge user settings found in Cakebox.yaml. Uses the Vagrant Util
# class to prevent a Vagrant plugin dependency + our custom 'compact' Hash
# cleaner class to prevent non-DRY checking per setting.
settings = Vagrant::Util::DeepMerge.deep_merge(settings, user_settings.compact!)

# Determine Cakebox Dashboard protocol only once
Expand Down Expand Up @@ -259,13 +262,19 @@ def Cakebox.configure(config, user_settings)
end
end

# Upload and run user created post-install bash script if it is found to
# support fully re-provisionable non-standard user box customizations.
if File.exists?('Cakebox.sh')
config.vm.provision "file", source: "Cakebox.sh", destination: "/home/vagrant/.cakebox/last-known-cakebox.sh"
config.vm.provision "shell" do |s|
s.privileged = false
s.inline = "bash /home/vagrant/.cakebox/last-known-cakebox.sh"
# Upload and run user created customization bash script (if found) to allow
# the user to create fully re-provisionable box customizations.
unless settings['user_script'].nil?
if ( settings['user_script'] =~ /^~/ )
settings['user_script'] = settings['user_script'].sub(/^~/, Dir.home)
end

if File.exists?(settings['user_script'])
config.vm.provision "file", source: settings['user_script'], destination: "/home/vagrant/.cakebox/last-known-user-script.sh"
config.vm.provision "shell" do |s|
s.privileged = false
s.inline = "bash /home/vagrant/.cakebox/last-known-user-script.sh"
end
end
end

Expand Down
2 changes: 2 additions & 0 deletions Cakebox.yaml.default
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ sites:
databases:

software:

user_script: