如何将文件夹引用添加到 PBXGroup?

How to add folder reference to PBXGroup?

我想使用 ruby 将 'folder reference' 添加到 PBXGroup。在 github.com/CocoaPods/Xcodeproj

中找不到解决方案
   file_path = File.join(to_folder, folder_to_fetch)
    file_reference = destination_group.new_file(file_path, :group)

    project.native_targets.each do |target|
#        ... ???
    end

找到解决方案 - 盲目:

file_path = destination_folder_path 
file_reference = destination_group.new_file(file_path, :project)
file_reference.path = file_path 
file_reference.include_in_index = '0' 
file_reference.set_explicit_file_type('folder') 
file_reference.last_known_file_type = 'folder'

project.native_targets.each do |target| 
   target.add_resources([file_reference]) 
end 

project.save