2010-09-04 03:39:44 +00:00
|
|
|
require 'fileutils'
|
|
|
|
|
2010-09-04 02:25:48 +00:00
|
|
|
module VagrantTestHelpers
|
|
|
|
module Path
|
|
|
|
# Path to the tmp directory for the tests
|
|
|
|
def tmp_path
|
2010-09-07 01:29:49 +00:00
|
|
|
result = Vagrant.source_root.join("test", "tmp")
|
|
|
|
FileUtils.mkdir_p(result)
|
|
|
|
result
|
2010-09-04 02:25:48 +00:00
|
|
|
end
|
2010-09-04 03:39:44 +00:00
|
|
|
|
|
|
|
# Path to the "home" directory for the tests
|
|
|
|
def home_path
|
2010-09-07 18:30:48 +00:00
|
|
|
result = tmp_path.join("home")
|
|
|
|
FileUtils.mkdir_p(result)
|
|
|
|
result
|
|
|
|
end
|
|
|
|
|
|
|
|
# Path to the boxes directory in the home directory
|
|
|
|
def boxes_path
|
|
|
|
result = home_path.join("boxes")
|
|
|
|
FileUtils.mkdir_p(result)
|
|
|
|
result
|
2010-09-04 03:39:44 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# Cleans all the test temp paths
|
|
|
|
def clean_paths
|
|
|
|
FileUtils.rm_rf(tmp_path)
|
|
|
|
FileUtils.mkdir_p(tmp_path)
|
|
|
|
end
|
2010-09-04 02:25:48 +00:00
|
|
|
end
|
|
|
|
end
|