Put plugins in their own Gemfile group so we can load on their own
This commit is contained in:
parent
e800743d06
commit
8cfa24143d
|
@ -39,6 +39,10 @@ if argv.include?("--debug")
|
||||||
ENV["VAGRANT_LOG"] = "debug"
|
ENV["VAGRANT_LOG"] = "debug"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Setup our dependencies by initializing Bundler
|
||||||
|
require "bundler"
|
||||||
|
Bundler.setup
|
||||||
|
|
||||||
require 'log4r'
|
require 'log4r'
|
||||||
require 'vagrant'
|
require 'vagrant'
|
||||||
require 'vagrant/cli'
|
require 'vagrant/cli'
|
||||||
|
|
|
@ -261,4 +261,4 @@ Vagrant.source_root.join("plugins").children(true).each do |directory|
|
||||||
end
|
end
|
||||||
|
|
||||||
# If we have plugins enabled, then load those
|
# If we have plugins enabled, then load those
|
||||||
Bundler.require(:default) if Vagrant.plugins_enabled?
|
Bundler.require(:plugins) if Vagrant.plugins_enabled?
|
||||||
|
|
|
@ -39,9 +39,8 @@ module Vagrant
|
||||||
"#{Vagrant.user_data_path.join("gems")}#{::File::PATH_SEPARATOR}#{@gem_path}"
|
"#{Vagrant.user_data_path.join("gems")}#{::File::PATH_SEPARATOR}#{@gem_path}"
|
||||||
Gem.clear_paths
|
Gem.clear_paths
|
||||||
|
|
||||||
# Load Bundler and setup our paths
|
# Load Bundler now
|
||||||
require "bundler"
|
require "bundler"
|
||||||
::Bundler.setup
|
|
||||||
|
|
||||||
# Do some additional Bundler initialization
|
# Do some additional Bundler initialization
|
||||||
::Bundler.ui = ::Bundler::UI.new
|
::Bundler.ui = ::Bundler::UI.new
|
||||||
|
@ -70,7 +69,7 @@ module Vagrant
|
||||||
|
|
||||||
# Clean up any unused/old gems
|
# Clean up any unused/old gems
|
||||||
runtime = ::Bundler::Runtime.new(root, definition)
|
runtime = ::Bundler::Runtime.new(root, definition)
|
||||||
runtime.clean
|
#runtime.clean
|
||||||
|
|
||||||
definition.specs
|
definition.specs
|
||||||
end
|
end
|
||||||
|
@ -85,9 +84,11 @@ module Vagrant
|
||||||
gemfile.puts(%Q[source "https://rubygems.org"])
|
gemfile.puts(%Q[source "https://rubygems.org"])
|
||||||
gemfile.puts(%Q[source "http://gems.hashicorp.com"])
|
gemfile.puts(%Q[source "http://gems.hashicorp.com"])
|
||||||
gemfile.puts(%Q[gem "vagrant", "= #{Vagrant::VERSION}"])
|
gemfile.puts(%Q[gem "vagrant", "= #{Vagrant::VERSION}"])
|
||||||
|
gemfile.puts("group :plugins do")
|
||||||
plugins.each do |plugin|
|
plugins.each do |plugin|
|
||||||
gemfile.puts(%Q[gem "#{plugin}"])
|
gemfile.puts(%Q[gem "#{plugin}"])
|
||||||
end
|
end
|
||||||
|
gemfile.puts("end")
|
||||||
gemfile.close
|
gemfile.close
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,6 +25,7 @@ module Vagrant
|
||||||
# Installs another plugin into our gem directory.
|
# Installs another plugin into our gem directory.
|
||||||
#
|
#
|
||||||
# @param [String] name Name of the plugin (gem)
|
# @param [String] name Name of the plugin (gem)
|
||||||
|
# @return [Gem::Specification]
|
||||||
def install_plugin(name)
|
def install_plugin(name)
|
||||||
result = nil
|
result = nil
|
||||||
Vagrant::Bundler.instance.install(installed_plugins.push(name)).each do |spec|
|
Vagrant::Bundler.instance.install(installed_plugins.push(name)).each do |spec|
|
||||||
|
@ -33,6 +34,9 @@ module Vagrant
|
||||||
result = spec
|
result = spec
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Add the plugin to the state file
|
||||||
|
@global_file.add_plugin(result.name)
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue