Remove Vagrant 0.8.0 transition code.

This commit is contained in:
Mitchell Hashimoto 2011-12-03 18:10:51 -08:00
parent 02cc1447dc
commit cb5f6b57f4
2 changed files with 0 additions and 51 deletions

View File

@ -115,27 +115,6 @@ module Vagrant
@_home_path ||= Pathname.new(File.expand_path(ENV["VAGRANT_HOME"] || DEFAULT_HOME)) @_home_path ||= Pathname.new(File.expand_path(ENV["VAGRANT_HOME"] || DEFAULT_HOME))
@logger.info("Home path: #{@_home_path}") @logger.info("Home path: #{@_home_path}")
# This is the old default that Vagrant used to be put things into
# up until Vagrant 0.8.0. We keep around an automatic migration
# script here in case any old users upgrade.
old_home = File.expand_path("~/.vagrant")
if File.exists?(old_home) && File.directory?(old_home)
@logger.info("Found both an old and new Vagrantfile. Migration initiated.")
# We can't migrate if the home directory already exists
if File.exists?(@_home_path)
ui.warn I18n.t("vagrant.general.home_dir_migration_failed",
:old => old_home,
:new => @_home_path.to_s)
else
# If the new home path doesn't exist, simply transition to it
ui.info I18n.t("vagrant.general.moving_home_dir", :directory => @_home_path)
FileUtils.mv(old_home, @_home_path)
end
end
# Return the home path
@_home_path @_home_path
end end

View File

@ -79,36 +79,6 @@ class EnvironmentTest < Test::Unit::TestCase
expected = Pathname.new(File.expand_path(ENV["VAGRANT_HOME"])) expected = Pathname.new(File.expand_path(ENV["VAGRANT_HOME"]))
assert_equal expected, @env.home_path assert_equal expected, @env.home_path
end end
should "move the old home directory to the new location" do
new_path = @home_path.join(".vagrant.d")
old_path = @home_path.join(".vagrant")
old_path.mkdir
# Get the home path
ENV["VAGRANT_HOME"] = new_path.to_s
assert !new_path.exist?
assert_equal new_path, @env.home_path
assert !old_path.exist?
assert new_path.exist?
end
should "not move the old home directory if the new one already exists" do
new_path = @home_path.join(".vagrant.d")
new_path.mkdir
old_path = @home_path.join(".vagrant")
old_path.mkdir
# Get the home path
ENV["VAGRANT_HOME"] = new_path.to_s
assert new_path.exist?
assert_equal new_path, @env.home_path
assert old_path.exist?
assert new_path.exist?
end
end end
context "temp path" do context "temp path" do