class Object

Public Instance Methods

merge_to_docc_folder(paths) click to toggle source

If we have an non-empty .docc folder, remove all paths under the folder but keep the folder itself

@param [Array<Pathname>] paths the paths to inspect

@return [Array<Pathname>] The resulted list of paths.

# File lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb, line 342
def merge_to_docc_folder(paths)
  docc_paths_with_files = Set.new
  allowable_paths = paths.select do |path|
    path_str = path.to_s

    if path_str =~ /\.docc(\/|$)/i

      # we want folder with files
      next if path.directory?

      # remove everything after ".docc", but keep ".docc"
      folder_path = path_str.split("\.docc")[0] + "\.docc"

      docc_paths_with_files << Pathname(folder_path)
      next

    end
    true
  end

  allowable_paths + docc_paths_with_files.to_a
end