lib/cocoapods/sandbox/path_list.rb
def relative_glob(patterns, options = {})
        return [] if patterns.empty?

        cache_key = options.merge(:patterns => patterns)
        cached_value = @glob_cache[cache_key]
        return cached_value if cached_value

        dir_pattern = options[:dir_pattern]
        exclude_patterns = options[:exclude_patterns]
        include_dirs = options[:include_dirs]

        if include_dirs
          full_list = files + dirs
        else
          full_list = files
        end

        list = Array(patterns).map do |pattern|
          if directory?(pattern) && dir_pattern
            pattern += '/' unless pattern.end_with?('/')
            pattern += dir_pattern
          end
          expanded_patterns = dir_glob_equivalent_patterns(pattern)
          full_list.select do |path|
            expanded_patterns.any? do |p|
              File.fnmatch(p, path, File::FNM_CASEFOLD | File::FNM_PATHNAME)
            end
          end
        end.flatten

        list = list.map { |path| Pathname.new(path) }
        if exclude_patterns
          exclude_options = { :dir_pattern => '**/*', :include_dirs => include_dirs }
          list -= relative_glob(exclude_patterns, exclude_options)
        end
        @glob_cache[cache_key] = list
      end
# The list of relative paths that are case insensitively matched by a
# given pattern. This method emulates {Dir#glob} with the
# {File::FNM_CASEFOLD} option.
#
# @param  [String,Array<String>] patterns
#         A single {Dir#glob} like pattern, or a list of patterns.
#
# @param  [Hash] options
#
# @option options [String] :dir_pattern
#         An optional pattern to append to a pattern, if it is the path
#         to a directory.
#
# @option options [Array<String>] :exclude_patterns
#         Exclude specific paths given by those patterns.
#
# @option options [Array<String>] :include_dirs
#         Additional paths to take into account for matching.
#
# @return [Array<Pathname>]
#
The list of relative paths that are case insensitively matched by a
given pattern. This method emulates {Dir#glob} with the
{File::FNM_CASEFOLD} option.
The list of relative paths that are case insensitively matched by a given pattern . This method emulates { Dir#glob } with the { File :: FNM_CASEFOLD } option .
def relative_glob(patterns, options = {})
        return [] if patterns.empty?
        cache_key = options.merge(:patterns => patterns)
        cached_value = @glob_cache[cache_key]
        return cached_value if cached_value
        dir_pattern = options[:dir_pattern]
        exclude_patterns = options[:exclude_patterns]
        include_dirs = options[:include_dirs]
        if include_dirs
          full_list = files + dirs
        else
          full_list = files
        end
        list = Array(patterns).map do |pattern|
          if directory?(pattern) && dir_pattern
            pattern += '/' unless pattern.end_with?('/')
            pattern += dir_pattern
          end
          expanded_patterns = dir_glob_equivalent_patterns(pattern)
          full_list.select do |path|
            expanded_patterns.any? do |p|
              File.fnmatch(p, path, File::FNM_CASEFOLD | File::FNM_PATHNAME)
            end
          end
        end.flatten
        list = list.map { |path| Pathname.new(path) }
        if exclude_patterns
          exclude_options = { :dir_pattern => '**/*', :include_dirs => include_dirs }
          list -= relative_glob(exclude_patterns, exclude_options)
        end
        @glob_cache[cache_key] = list
      end
def relative_glob ( patterns , options = { } ) return [ ] if patterns . empty? cache_key = options . merge ( :patterns => patterns ) cached_value = @glob_cache [ cache_key ] return cached_value if cached_value dir_pattern = options [ :dir_pattern ] exclude_patterns = options [ :exclude_patterns ] include_dirs = options [ :include_dirs ] if include_dirs full_list = files + dirs else full_list = files end list = Array ( patterns ) . map do | pattern | if directory? ( pattern ) && dir_pattern pattern += '/' unless pattern . end_with? ( '/' ) pattern += dir_pattern end expanded_patterns = dir_glob_equivalent_patterns ( pattern ) full_list . select do | path | expanded_patterns . any? do | p | File . fnmatch ( p , path , File :: FNM_CASEFOLD | File :: FNM_PATHNAME ) end end end . flatten list = list . map { | path | Pathname . new ( path ) } if exclude_patterns exclude_options = { :dir_pattern => '**/*' , :include_dirs => include_dirs } list -= relative_glob ( exclude_patterns , exclude_options ) end @glob_cache [ cache_key ] = list end
The list of relative paths that are case insensitively matched by a
given pattern.
The list of relative paths that are case insensitively matched by a given pattern .
None
Array<Pathname>
patterns
options
:include_dirs Additional paths to take into account for matching.
: include_dirs Additional paths to take into account for matching .
None