Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Vagrant config stuff
# Before Vagrant.configure()
required_plugins = %w(vagrant-timezone)
required_plugins.each do |plugin|
need_restart = false
unless Vagrant.has_plugin? plugin
puts "Installing" + plugin + "..."
system "vagrant plugin install #{plugin}"
need_restart = true
end
exec "vagrant #{ARGV.join(' ')}" if need_restart
end
# INSIDE Of Vagrant.configure()
if RUBY_PLATFORM["darwin"]
time_zone=`sudo systemsetup -gettimezone|cut -d':' -f2| tr -d '[[:space:]]'`
elsif RUBY_PLATFORM["linux"]
time_zone=`cat /etc/timezone| tr -d '[[:space:]]'`
else
# FIXME: Handle windows
# time_zone=`tzutil /g`
end
if Vagrant.has_plugin?("vagrant-timezone")
config.timezone.value = time_zone
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.