module Bundler::YAMLSerializer

def dump_hash(hash)

def dump_hash(hash)
  yaml = String.new("\n")
  hash.each do |k, v|
    yaml << k << ":"
    if v.is_a?(Hash)
      yaml << dump_hash(v).gsub(/^(?!$)/, "  ") # indent all non-empty lines
    elsif v.is_a?(Array) # Expected to be array of strings
      if v.empty?
        yaml << " []\n"
      else
        yaml << "\n- " << v.map {|s| s.to_s.gsub(/\s+/, " ").inspect }.join("\n- ") << "\n"
      end
    else
      yaml << " " << v.to_s.gsub(/\s+/, " ").inspect << "\n"
    end
  end
  yaml
end