Ruby 1.8 compatibility

This commit is contained in:
Mitchell Hashimoto 2011-07-11 20:13:19 -07:00
parent dd31453c1a
commit 4c6673270a
2 changed files with 7 additions and 2 deletions

View File

@ -324,10 +324,13 @@ module Vagrant
return @root_path if defined?(@root_path)
root_finder = lambda do |path|
vagrantfile_name.each do |rootfile|
return path if File.exist?(File.join(path.to_s, rootfile))
# Note: To remain compatible with Ruby 1.8, we have to use
# a `find` here instead of an `each`.
found = vagrantfile_name.find do |rootfile|
File.exist?(File.join(path.to_s, rootfile))
end
return path if found
return nil if path.root? || !File.exist?(path)
root_finder.call(path.parent)
end

View File

@ -1,3 +1,5 @@
require 'thread'
module Vagrant
module Util
# Atomic counter implementation. This is useful for incrementing