module Bundler::SharedHelpers

def search_up(*names)

def search_up(*names)
  previous = nil
  current  = File.expand_path(SharedHelpers.pwd)
  until !File.directory?(current) || current == previous
    if ENV["BUNDLE_SPEC_RUN"]
      # avoid stepping above the tmp directory when testing
      return nil if File.file?(File.join(current, "bundler.gemspec"))
    end
    names.each do |name|
      filename = File.join(current, name)
      yield filename
    end
    previous = current
    current = File.expand_path("..", current)
  end
end