Slight cosmetic changes to get things working with emacs highlighter and commenting

This commit is contained in:
Mitchell Hashimoto 2010-05-14 23:25:12 -07:00
parent c8e36274d6
commit 3e4a20d919
2 changed files with 11 additions and 2 deletions

View File

@ -23,7 +23,7 @@ module Vagrant
#--------------------------------------------------------------- #---------------------------------------------------------------
# Class Methods # Class Methods
#--------------------------------------------------------------- #---------------------------------------------------------------
class <<self class << self
# Loads and returns an environment given a specific working # Loads and returns an environment given a specific working
# directory. If a working directory is not given, it will default # directory. If a working directory is not given, it will default
# to the pwd. # to the pwd.
@ -203,11 +203,15 @@ module Vagrant
# probably (read: should be) set on the VM attribute, so we do # probably (read: should be) set on the VM attribute, so we do
# nothing. # nothing.
return if vm_name return if vm_name
# Or, return if there is no root path set or the dotfile doesn't
# exist, since we can't do anything in that case anyways.
return if !root_path || !File.file?(dotfile_path) return if !root_path || !File.file?(dotfile_path)
# Empty out previously loaded vms # Empty out previously loaded vms
vms.clear vms.clear
# Open and parse the dotfile
File.open(dotfile_path) do |f| File.open(dotfile_path) do |f|
data = { :__vagrant => f.read } data = { :__vagrant => f.read }

View File

@ -6,7 +6,7 @@ module Vagrant
attr_reader :system attr_reader :system
attr_accessor :vm attr_accessor :vm
class <<self class << self
# Finds a virtual machine by a given UUID and either returns # Finds a virtual machine by a given UUID and either returns
# a Vagrant::VM object or returns nil. # a Vagrant::VM object or returns nil.
def find(uuid, env=nil, vm_name=nil) def find(uuid, env=nil, vm_name=nil)
@ -27,12 +27,17 @@ module Vagrant
@vm = opts[:vm] @vm = opts[:vm]
if !opts[:env].nil? if !opts[:env].nil?
# We have an environment, so we create a new child environment
# specifically for this VM. This step will load any custom
# config and such.
@env = Vagrant::Environment.new({ @env = Vagrant::Environment.new({
:cwd => opts[:env].cwd, :cwd => opts[:env].cwd,
:parent => opts[:env], :parent => opts[:env],
:vm_name => opts[:vm_name], :vm_name => opts[:vm_name],
:vm => self :vm => self
}).load! }).load!
# Load the associated system.
load_system! load_system!
end end
end end