Created
September 16, 2017 16:35
-
-
Save manjiii/3b2114b693f2b06cb8e12a8adadf28b1 to your computer and use it in GitHub Desktop.
Vagrantfileでup時に必要なプラグインを自動でインストールする ref: http://qiita.com/Manjiii/items/3ebbc772509f9f040376
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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