Commit e5935453 by UmanShahzad

Check for exempt subcommands & move vagrantplugins to vagrant dir.

Moved logic to check if plugin installation check
is necessary into vagrantplugins.rb.
parent e1031638
Vagrant.require_version ">= 1.8.7"
unless ARGV.empty?
require_relative '../../../vagrantplugins'
install_plugins(['vagrant-vbguest'])
end
require_relative '../../vagrantplugins'
install_plugins(['vagrant-vbguest'])
VAGRANTFILE_API_VERSION = "2"
......
Vagrant.require_version ">= 1.8.7"
unless ARGV.empty?
require_relative '../../../vagrantplugins'
install_plugins(['vagrant-vbguest'])
end
require_relative '../../vagrantplugins'
install_plugins(['vagrant-vbguest'])
VAGRANTFILE_API_VERSION = "2"
......
Vagrant.require_version ">= 1.8.7"
require_relative '../../vagrantplugins'
install_plugins(['vagrant-vbguest'])
unless ARGV.empty?
require_relative '../../../vagrantplugins'
install_plugins(['vagrant-vbguest'])
end
VAGRANTFILE_API_VERSION = "2"
......
Vagrant.require_version ">= 1.8.7"
unless ARGV.empty?
require_relative '../../../vagrantplugins'
install_plugins(['vagrant-vbguest'])
end
require_relative '../../vagrantplugins'
install_plugins(['vagrant-vbguest'])
VAGRANTFILE_API_VERSION = "2"
......
# Don't check for plugins on certain subcommands of vagrant.
def is_check_necessary
exempt = ['help', 'plugin', 'version']
return ARGV.any? ? (ARGV & exempt).empty? : false
end
def install_plugins(plugins)
not_installed = get_not_installed(plugins)
if not_installed.any?
puts "The following required plugins must be installed:"
puts "'#{not_installed.join("', '")}'"
print "Install? [y]/n: "
unless STDIN.gets.chomp == "n"
not_installed.each { |plugin| install_plugin(plugin) }
else
exit
if not is_check_necessary
exit
end
not_installed = get_not_installed(plugins)
if not_installed.any?
puts "The following required plugins must be installed:"
puts "'#{not_installed.join("', '")}'"
print "Install? [y]/n: "
unless STDIN.gets.chomp == "n"
not_installed.each { |plugin| install_plugin(plugin) }
else
exit
end
$? ? continue : raise('Plugin installation failed, see errors above.')
end
$? ? continue : raise('Plugin installation failed, see errors above.')
end
end
def get_not_installed(plugins)
not_installed = []
plugins.each do |plugin|
unless Vagrant.has_plugin?(plugin)
not_installed << plugin
not_installed = []
plugins.each do |plugin|
unless Vagrant.has_plugin?(plugin)
not_installed << plugin
end
end
end
return not_installed
return not_installed
end
def install_plugin(plugin)
system "vagrant plugin install #{plugin}"
system "vagrant plugin install #{plugin}"
end
# If plugins successfully installed, restart vagrant to detect changes.
def continue
exec "vagrant #{ARGV.join(' ')}"
exec "vagrant #{ARGV.join(' ')}"
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment