Skip to content

Instantly share code, notes, and snippets.

@manjiii
Created September 16, 2017 16:35
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 manjiii/3b2114b693f2b06cb8e12a8adadf28b1 to your computer and use it in GitHub Desktop.
Save manjiii/3b2114b693f2b06cb8e12a8adadf28b1 to your computer and use it in GitHub Desktop.
Vagrantfileでup時に必要なプラグインを自動でインストールする ref: http://qiita.com/Manjiii/items/3ebbc772509f9f040376
if ARGV[0] == 'up'
plugins_dependencies = %w( vagrant-vbguest vagrant-docker-compose ) # <- ここに必要なプラグインを列挙する
plugin_status = false
plugins_dependencies.each do |plugin_name|
unless Vagrant.has_plugin? plugin_name
puts "#{plugin_name} is required."
system("vagrant plugin install #{plugin_name}")
plugin_status = true
end
end
#Restart Vagrant if any new plugin installed
if plugin_status === true
exec "vagrant #{ARGV.join' '}"
else
puts "All Plugin Dependencies already installed"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment