Environment#data_dir

This is basically a directory to store state.
This commit is contained in:
Mitchell Hashimoto 2013-01-18 11:37:49 -08:00
parent 10a051a64b
commit 0bd0752bf2
1 changed files with 10 additions and 2 deletions

View File

@ -26,6 +26,13 @@ module Vagrant
# The `cwd` that this environment represents # The `cwd` that this environment represents
attr_reader :cwd attr_reader :cwd
# The persistent data directory where global data can be stored. It
# is up to the creator of the data in this directory to properly
# remove it when it is no longer needed.
#
# @return [Pathname]
attr_reader :data_dir
# The valid name for a Vagrantfile for this environment. # The valid name for a Vagrantfile for this environment.
attr_reader :vagrantfile_name attr_reader :vagrantfile_name
@ -101,9 +108,10 @@ module Vagrant
# Setup the home directory # Setup the home directory
setup_home_path setup_home_path
@tmp_path = @home_path.join("tmp")
@boxes_path = @home_path.join("boxes") @boxes_path = @home_path.join("boxes")
@data_dir = @home_path.join("data")
@gems_path = @home_path.join("gems") @gems_path = @home_path.join("gems")
@tmp_path = @home_path.join("tmp")
# Setup the local data directory. If a configuration path is given, # Setup the local data directory. If a configuration path is given,
# then it is expanded relative to the working directory. Otherwise, # then it is expanded relative to the working directory. Otherwise,
@ -457,7 +465,7 @@ module Vagrant
# Setup the list of child directories that need to be created if they # Setup the list of child directories that need to be created if they
# don't already exist. # don't already exist.
dirs = [@home_path] dirs = [@home_path]
subdirs = ["tmp", "boxes", "gems"] subdirs = ["boxes", "data", "gems", "tmp"]
dirs += subdirs.collect { |subdir| @home_path.join(subdir) } dirs += subdirs.collect { |subdir| @home_path.join(subdir) }
# Go through each required directory, creating it if it doesn't exist # Go through each required directory, creating it if it doesn't exist