commands/plugin: allow within Bundler env (cause we always are)
This commit is contained in:
parent
8adef9c15f
commit
5387984e0f
|
@ -8,7 +8,6 @@ module VagrantPlugins
|
||||||
# This middleware sequence will install a plugin.
|
# This middleware sequence will install a plugin.
|
||||||
def self.action_install
|
def self.action_install
|
||||||
Vagrant::Action::Builder.new.tap do |b|
|
Vagrant::Action::Builder.new.tap do |b|
|
||||||
b.use BundlerCheck
|
|
||||||
b.use InstallGem
|
b.use InstallGem
|
||||||
b.use PruneGems
|
b.use PruneGems
|
||||||
end
|
end
|
||||||
|
@ -17,7 +16,6 @@ module VagrantPlugins
|
||||||
# This middleware sequence licenses paid addons.
|
# This middleware sequence licenses paid addons.
|
||||||
def self.action_license
|
def self.action_license
|
||||||
Vagrant::Action::Builder.new.tap do |b|
|
Vagrant::Action::Builder.new.tap do |b|
|
||||||
b.use BundlerCheck
|
|
||||||
b.use LicensePlugin
|
b.use LicensePlugin
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -25,7 +23,6 @@ module VagrantPlugins
|
||||||
# This middleware sequence will list all installed plugins.
|
# This middleware sequence will list all installed plugins.
|
||||||
def self.action_list
|
def self.action_list
|
||||||
Vagrant::Action::Builder.new.tap do |b|
|
Vagrant::Action::Builder.new.tap do |b|
|
||||||
b.use BundlerCheck
|
|
||||||
b.use ListPlugins
|
b.use ListPlugins
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -33,7 +30,6 @@ module VagrantPlugins
|
||||||
# This middleware sequence will uninstall a plugin.
|
# This middleware sequence will uninstall a plugin.
|
||||||
def self.action_uninstall
|
def self.action_uninstall
|
||||||
Vagrant::Action::Builder.new.tap do |b|
|
Vagrant::Action::Builder.new.tap do |b|
|
||||||
b.use BundlerCheck
|
|
||||||
b.use UninstallPlugin
|
b.use UninstallPlugin
|
||||||
b.use PruneGems
|
b.use PruneGems
|
||||||
end
|
end
|
||||||
|
@ -42,7 +38,6 @@ module VagrantPlugins
|
||||||
# This middleware sequence will update a plugin.
|
# This middleware sequence will update a plugin.
|
||||||
def self.action_update
|
def self.action_update
|
||||||
Vagrant::Action::Builder.new.tap do |b|
|
Vagrant::Action::Builder.new.tap do |b|
|
||||||
b.use BundlerCheck
|
|
||||||
b.use PluginExistsCheck
|
b.use PluginExistsCheck
|
||||||
b.use InstallGem
|
b.use InstallGem
|
||||||
b.use PruneGems
|
b.use PruneGems
|
||||||
|
@ -51,7 +46,6 @@ module VagrantPlugins
|
||||||
|
|
||||||
# The autoload farm
|
# The autoload farm
|
||||||
action_root = Pathname.new(File.expand_path("../action", __FILE__))
|
action_root = Pathname.new(File.expand_path("../action", __FILE__))
|
||||||
autoload :BundlerCheck, action_root.join("bundler_check")
|
|
||||||
autoload :InstallGem, action_root.join("install_gem")
|
autoload :InstallGem, action_root.join("install_gem")
|
||||||
autoload :LicensePlugin, action_root.join("license_plugin")
|
autoload :LicensePlugin, action_root.join("license_plugin")
|
||||||
autoload :ListPlugins, action_root.join("list_plugins")
|
autoload :ListPlugins, action_root.join("list_plugins")
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
module VagrantPlugins
|
|
||||||
module CommandPlugin
|
|
||||||
module Action
|
|
||||||
class BundlerCheck
|
|
||||||
def initialize(app, env)
|
|
||||||
@app = app
|
|
||||||
end
|
|
||||||
|
|
||||||
def call(env)
|
|
||||||
# Bundler sets up its own custom gem load paths such that our
|
|
||||||
# own gems are never loaded. Therefore, give an error if a user
|
|
||||||
# tries to install gems while within a Bundler-managed environment.
|
|
||||||
if defined?(Bundler)
|
|
||||||
require 'bundler/shared_helpers'
|
|
||||||
if Bundler::SharedHelpers.in_bundle?
|
|
||||||
raise Vagrant::Errors::GemCommandInBundler
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
@app.call(env)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in New Issue