vagrant-lamp
vagrant-lamp copied to clipboard
Add support for vagrant-hostsupdater
Hi! i'm currently testing vagrant-hostsupdater plugin, with this you don't need to manually update the your host file.
this is the code so far:
config.vm.hostname = "vagrant-lamp"
# Local Machine Hosts
#
# If the Vagrant plugin hostsupdater (https://github.com/cogitatio/vagrant-hostsupdater) is
# installed, the following will automatically configure your local machine's hosts file to
# be aware of the domains specified below. Watch the provisioning script as you may need to
# enter a password for Vagrant to access your hosts file.
#
# By default, we'll include all the domains located under the data_bags/sites directory.
#
if defined?(VagrantPlugins::HostsUpdater)
hosts = []
Dir.glob('data_bags/sites/*.json') do |json_file|
file = File.read(json_file)
data = JSON.parse(file)
hosts.push(data['host'])
end
# Pass the found host names to the hostsupdater plugin so it can perform magic.
config.hostsupdater.aliases = hosts
config.hostsupdater.remove_on_suspend = true
end
any thoughts?
Hi Raúl,
That looks awesome! Actually I had it in my todo for more then year. But unfortunately, I'm pretty busy with my work lately, so haven't had the chance to do it myself. Thus said, I would greatly appreciate the pull request :)