Only proceed if confirmation is matched. Do not continue if user aborted.
This commit is contained in:
parent
b15ef3a6ff
commit
f045f74d86
|
@ -1,4 +1,3 @@
|
||||||
require 'pp'
|
|
||||||
require "vagrant/plugin/manager"
|
require "vagrant/plugin/manager"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
|
@ -22,26 +21,29 @@ module VagrantPlugins
|
||||||
I18n.t("vagrant.commands.plugin.expunge_confirm") +
|
I18n.t("vagrant.commands.plugin.expunge_confirm") +
|
||||||
" [Y/N]:"
|
" [Y/N]:"
|
||||||
)
|
)
|
||||||
if result.to_s.downcase.strip == 'n'
|
if result.to_s.downcase.strip != 'y'
|
||||||
exit 1
|
abort_action = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
plugins = Vagrant::Plugin::Manager.instance.installed_plugins
|
if !abort_action
|
||||||
plugins_json = File.join(env[:home_path], "plugins.json")
|
plugins_json = File.join(env[:home_path], "plugins.json")
|
||||||
plugins_gems = env[:gems_path]
|
plugins_gems = env[:gems_path]
|
||||||
|
|
||||||
if File.exist?(plugins_json)
|
if File.exist?(plugins_json)
|
||||||
FileUtils.rm(plugins_json)
|
FileUtils.rm(plugins_json)
|
||||||
|
end
|
||||||
|
|
||||||
|
if File.directory?(plugins_gems)
|
||||||
|
FileUtils.rm_rf(plugins_gems)
|
||||||
|
end
|
||||||
|
|
||||||
|
env[:ui].info(I18n.t("vagrant.commands.plugin.expunge_complete"))
|
||||||
|
|
||||||
|
@app.call(env)
|
||||||
|
else
|
||||||
|
env[:ui].info(I18n.t("vagrant.commands.plugin.expunge_aborted"))
|
||||||
end
|
end
|
||||||
|
|
||||||
if File.directory?(plugins_gems)
|
|
||||||
FileUtils.rm_rf(plugins_gems)
|
|
||||||
end
|
|
||||||
|
|
||||||
env[:ui].info(I18n.t("vagrant.commands.plugin.expunge_complete"))
|
|
||||||
|
|
||||||
@app.call(env)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1591,6 +1591,9 @@ en:
|
||||||
expunge_reinstall: |-
|
expunge_reinstall: |-
|
||||||
|
|
||||||
Vagrant will now attempt to reinstall user plugins that were removed.
|
Vagrant will now attempt to reinstall user plugins that were removed.
|
||||||
|
expunge_aborted: |-
|
||||||
|
|
||||||
|
Vagrant expunge has been declined. Skipping removal of plugins.
|
||||||
installed_license: |-
|
installed_license: |-
|
||||||
The license for '%{name}' was successfully installed!
|
The license for '%{name}' was successfully installed!
|
||||||
installing_license: |-
|
installing_license: |-
|
||||||
|
|
Loading…
Reference in New Issue