commands/plugin: error if windows with space in dir [GH-4351]

This commit is contained in:
Mitchell Hashimoto 2014-08-29 12:16:40 -07:00
parent e5a7bfebbc
commit 4138179207
3 changed files with 18 additions and 0 deletions

View File

@ -528,6 +528,10 @@ module Vagrant
error_key(:plugin_install_license_not_found) error_key(:plugin_install_license_not_found)
end end
class PluginInstallSpace < VagrantError
error_key(:plugin_install_space)
end
class PluginInstallVersionConflict < VagrantError class PluginInstallVersionConflict < VagrantError
error_key(:plugin_install_version_conflict) error_key(:plugin_install_version_conflict)
end end

View File

@ -1,5 +1,6 @@
require "log4r" require "log4r"
require "vagrant/plugin/manager" require "vagrant/plugin/manager"
require "vagrant/util/platform"
module VagrantPlugins module VagrantPlugins
module CommandPlugin module CommandPlugin
@ -18,6 +19,14 @@ module VagrantPlugins
sources = env[:plugin_sources] sources = env[:plugin_sources]
version = env[:plugin_version] version = env[:plugin_version]
# If we're on Windows and the user data path has a space in it,
# then things won't work because of a Ruby bug.
if Vagrant::Util::Platform.windows?
if Vagrant.user_data_path.to_s.include?(" ")
raise Vagrant::Errors::PluginInstallSpace
end
end
# Install the gem # Install the gem
plugin_name_label = plugin_name plugin_name_label = plugin_name
plugin_name_label += " --version '#{version}'" if version plugin_name_label += " --version '#{version}'" if version

View File

@ -867,6 +867,11 @@ en:
The license file to install could not be found. Please verify The license file to install could not be found. Please verify
the path you gave is correct. The path to the license file given the path you gave is correct. The path to the license file given
was: '%{path}' was: '%{path}'
plugin_install_space: |-
The directory where plugins are installed (the Vagrant home directory)
has a space in it. On Windows, there is a bug in Ruby when compiling
plugins into directories with spaces. Please move your Vagrant home
directory to a path without spaces and try again.
plugin_install_version_conflict: |- plugin_install_version_conflict: |-
The plugin(s) can't be installed due to the version conflicts below. The plugin(s) can't be installed due to the version conflicts below.
This means that the plugins depend on a library version that conflicts This means that the plugins depend on a library version that conflicts