From 5762775998f1a81b3823e24dba83135bca604404 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 10 Dec 2011 20:22:44 -0800 Subject: [PATCH] Reorganize little methods and remove unused methods --- lib/vagrant/environment.rb | 41 +++++++++----------------------------- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/lib/vagrant/environment.rb b/lib/vagrant/environment.rb index 2cc72b639..f5178b724 100644 --- a/lib/vagrant/environment.rb +++ b/lib/vagrant/environment.rb @@ -8,7 +8,7 @@ module Vagrant # defined as basically a folder with a "Vagrantfile." This class allows # access to the VMs, CLI, etc. all in the scope of this environment. class Environment - HOME_SUBDIRS = ["tmp", "boxes", "logs"] + HOME_SUBDIRS = ["tmp", "boxes"] DEFAULT_VM = :default DEFAULT_HOME = "~/.vagrant.d" @@ -25,6 +25,12 @@ module Vagrant # global state. attr_reader :home_path + # The directory where temporary files for Vagrant go. + attr_reader :tmp_path + + # The directory where boxes are stored. + attr_reader :boxes_path + #--------------------------------------------------------------- # Class Methods #--------------------------------------------------------------- @@ -87,6 +93,8 @@ module Vagrant # Setup the home directory setup_home_path + @tmp_path = @home_path.join("tmp") + @boxes_path = @home_path.join("boxes") end #--------------------------------------------------------------- @@ -102,37 +110,6 @@ module Vagrant root_path.join(config.global.vagrant.dotfile_name) end - # The path to the Vagrant tmp directory - # - # @return [Pathname] - def tmp_path - home_path.join("tmp") - end - - # The path to the Vagrant boxes directory - # - # @return [Pathname] - def boxes_path - home_path.join("boxes") - end - - # Path to the Vagrant logs directory - # - # @return [Pathname] - def log_path - home_path.join("logs") - end - - # Returns the name of the resource which this environment represents. - # The resource is the VM name if there is a VM it represents, otherwise - # it defaults to "vagrant" - # - # @return [String] - def resource - result = vm.name rescue nil - result || "vagrant" - end - # Returns the collection of boxes for the environment. # # @return [BoxCollection]