From 462136cbf2f1b8f161e013d60c747de88c7df1e2 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 5 May 2012 13:08:07 -0700 Subject: [PATCH] Use the .vagrantrc for plugins! --- CHANGELOG.md | 4 ++-- lib/vagrant/environment.rb | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17edfd88f..3fb10b693 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,8 @@ so that plugins will always _load_ (though they will almost certainly not be _functional_ in future versions of Vagrant). - Plugins no longer "autoload" by simply gem installing them. This increases - Vagrant's initial startup time considerably. To replace this, you can use - the `vagrant plugin` interface. + Vagrant's initial startup time considerably. To replace this, you must now + explicitly require plugins in the `~/.vagrantrc` file. - Improve the SSH "ready?" check. [GH-841] - Human friendly error if connection times out for HTTP downloads. [GH-849] - Detect when the VirtualBox installation is incomplete and error. [GH-846] diff --git a/lib/vagrant/environment.rb b/lib/vagrant/environment.rb index 220ddc5f1..b81c8b8c5 100644 --- a/lib/vagrant/environment.rb +++ b/lib/vagrant/environment.rb @@ -15,6 +15,7 @@ module Vagrant HOME_SUBDIRS = ["tmp", "boxes", "gems"] DEFAULT_VM = :default DEFAULT_HOME = "~/.vagrant.d" + DEFAULT_RC = "~/.vagrantrc" # The `cwd` that this environment represents attr_reader :cwd @@ -519,7 +520,15 @@ module Vagrant ::Gem.clear_paths # Load the plugins - # XXX: TODO + rc_path = File.expand_path(ENV["VAGRANT_RC"] || DEFAULT_RC) + if File.file?(rc_path) + # We use a `require` here instead of a load so the same file will + # only be loaded once. + @logger.debug("Loading RC file: #{rc_path}") + require rc_path + else + @logger.debug("RC file not found. Not loading: #{rc_path}") + end end end end