Skip to content

Instantly share code, notes, and snippets.

@bretdavidson
Created April 3, 2015 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bretdavidson/1a769920d3a90fac4c5d to your computer and use it in GitHub Desktop.
Save bretdavidson/1a769920d3a90fac4c5d to your computer and use it in GitHub Desktop.
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