Load config files (only) early so plugins are loaded from Vagrantfiles

This commit is contained in:
Mitchell Hashimoto 2010-09-21 01:47:50 -06:00
parent 3b735e545f
commit f0294039e1
3 changed files with 7 additions and 7 deletions

View File

@ -5,6 +5,13 @@ require 'vagrant/cli'
env = Vagrant::Environment.new
begin
# Set the UI early in case any errors are raised, and load
# the config immediately, so we gather any new commands from
# plugins
env.ui = Vagrant::UI::Shell.new(env, Thor::Base.shell.new)
env.load!
# Kick start the CLI
Vagrant::CLI.start(ARGV, :env => env)
rescue Vagrant::Errors::VagrantError => e
opts = { :_translate => false, :_prefix => false }

View File

@ -6,7 +6,6 @@ module Vagrant
def initialize_environment(args, options, config)
raise Errors::CLIMissingEnvironment.new if !config[:env]
@env = config[:env]
@env.ui = UI::Shell.new(@env, shell) if !@env.ui.is_a?(UI::Shell)
end
# This returns an array of {VM} objects depending on the arguments

View File

@ -16,12 +16,6 @@ class CommandHelpersTest < Test::Unit::TestCase
should "raise an exception if no environment is given" do
assert_raises(Vagrant::Errors::CLIMissingEnvironment) { command([], nil) }
end
should "not raise an exception if environment is given and setup UI" do
env = vagrant_env
assert_nothing_raised { command([], env) }
assert env.ui.is_a?(Vagrant::UI::Shell)
end
end
context "vms from args" do