2014-01-06 04:50:25 +00:00
|
|
|
require "vagrant/plugin/manager"
|
2013-09-02 16:31:26 +00:00
|
|
|
|
|
|
|
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)
|
2014-01-06 04:57:55 +00:00
|
|
|
installed = Vagrant::Plugin::Manager.instance.installed_plugins
|
2014-01-06 04:50:25 +00:00
|
|
|
if !installed.has_key?(env[:plugin_name])
|
2013-09-02 16:31:26 +00:00
|
|
|
raise Vagrant::Errors::PluginNotInstalled,
|
|
|
|
name: env[:plugin_name]
|
|
|
|
end
|
|
|
|
|
|
|
|
@app.call(env)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|