Better plugin dev experience through warnings

This commit is contained in:
Mitchell Hashimoto 2013-03-28 17:10:07 -07:00
parent 72e0a691db
commit b32c0d16ac
3 changed files with 24 additions and 2 deletions

View File

@ -6,6 +6,8 @@ IMPROVEMENTS:
- Don't load `vagrant plugin` installed plugins when in a Bundler
environment. This happens during plugin development. This will make
Vagrant errors much quieter when developing plugins.
- Vagrant will detect Bundler environments, make assumptions that you're
developing plugins, and will quiet its error output a bit.
BUG FIXES:

View File

@ -52,8 +52,23 @@ begin
logger.debug("Creating Vagrant environment")
env = Vagrant::Environment.new(opts)
# If we're not in the installer, warn.
env.ui.warn(I18n.t("vagrant.general.not_in_installer")) if !Vagrant.in_installer?
if !Vagrant.in_installer?
warned = false
# If we're in a bundler environment, we assume it is for plugin
# development and will let the user know that.
if defined?(Bundler)
require 'bundler/shared_helpers'
if Bundler::SharedHelpers.in_bundle?
env.ui.warn(I18n.t("vagrant.general.in_bundler"))
env.ui.warn("")
warned = true
end
end
# If we're not in the installer, warn.
env.ui.warn(I18n.t("vagrant.general.not_in_installer")) if !warned
end
begin
# Execute the CLI interface, and exit with the proper error code

View File

@ -18,6 +18,11 @@ en:
Old: %{old}
New: %{new}
in_bundler: |-
You appear to be running Vagrant in a Bundler environment. Because
Vagrant should be run within installers (outside of Bundler), Vagrant
will assume that you're developing plugins and will change its behavior
in certain ways to better assist plugin development.
not_in_installer: |-
You appear to be running Vagrant outside of the official installers.
Note that the installers are what ensure that Vagrant has all required