vagrant/plugins/commands/plugin/action/plugin_exists_check.rb

26 lines
651 B
Ruby
Raw Normal View History

require "vagrant/plugin/manager"
module VagrantPlugins
module CommandPlugin
module Action
# This class checks to see if the plugin is installed already, and
# if so, raises an exception/error to output to the user.
class PluginExistsCheck
def initialize(app, env)
@app = app
end
def call(env)
installed = Vagrant::Plugin::Manager.instance.installed_plugins
2015-01-05 23:29:01 +00:00
if !installed.key?(env[:plugin_name])
raise Vagrant::Errors::PluginNotInstalled,
name: env[:plugin_name]
end
@app.call(env)
end
end
end
end
end