Skip to content

Instantly share code, notes, and snippets.

@arbalest
Created November 22, 2017 17:22
Show Gist options
  • Save arbalest/bbc2182887ccbaea3fb57c5336abfd64 to your computer and use it in GitHub Desktop.
Save arbalest/bbc2182887ccbaea3fb57c5336abfd64 to your computer and use it in GitHub Desktop.
Access Ruby variables in the Homestead.yaml file by means of string formatting in homestead.rb (Laravel Vagrant template)
# ...
# Register All Of The Configured Shared Folders
if settings.include? 'folders'
settings["folders"].each do |folder|
# folder["map"].sub!('{{USERPROFILE}}', ENV['USERPROFILE'])
folder["map"] = folder["map"] % { :USERPROFILE => ENV['USERPROFILE'] }
if File.exists? File.expand_path(folder["map"])
# ...
end
end
end
# ...
# Yaml sample:
# folders:
# - map: "%{USERPROFILE}/tmp"
# to: /home/vagrant/apps
# options:
# fsnotify: true
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment