class Pod::Sandbox::FileAccessor


@note The FileAccessor always returns absolute paths.
for directories.
taking into account any exclude pattern and the default extensions to use
Resolves the file patterns of a specification against its root directory,

def expanded_paths(patterns, options = {})

Returns:
  • (Array) - A list of the paths.

Raises:
  • (Informative) - If the pod does not exists.

Parameters:
  • exclude_patterns (Array) --
  • dir_pattern (String) --
  • patterns (Array) --
def expanded_paths(patterns, options = {})
  return [] if patterns.empty?
  result = []
  result << path_list.glob(patterns, options)
  result.flatten.compact.uniq
end

def glob_for_attribute(attrbute)

Returns:
  • (String) - the glob pattern.

Parameters:
  • attribute (Symbol) --
def glob_for_attribute(attrbute)
  globs = {
    :source_files => '*.{h,hpp,hh,m,mm,c,cpp}'.freeze,
    :public_header_files => "*.{#{ HEADER_EXTENSIONS * ',' }}".freeze,
  }
  globs[attrbute]
end

def headers

Returns:
  • (Array) - the headers of the specification.
def headers
  extensions = HEADER_EXTENSIONS
  source_files.select { |f| extensions.include?(f.extname) }
end

def initialize(path_list, spec_consumer)

Parameters:
  • spec_consumer (Specification::Consumer) -- @see spec_consumer
  • path_list (Sandbox::PathList, Pathname) -- @see path_list
def initialize(path_list, spec_consumer)
  if path_list.is_a?(PathList)
    @path_list = path_list
  else
    @path_list = PathList.new(path_list)
  end
  @spec_consumer = spec_consumer
  unless @spec_consumer
    raise Informative, "Attempt to initialize File Accessor without a specification consumer."
  end
end

def inspect

Returns:
  • (String) - A string suitable for debugging.
def inspect
  "<#{self.class} spec=#{spec.name} platform=#{platform_name} root=#{root}>"
end

def license

Returns:
  • (Pathname) - The path of the license file as indicated in the
def license
  if spec_consumer.spec.root.license[:file]
    path_list.root + spec_consumer.spec.root.license[:file]
  else
    path_list.glob(%w[ licen{c,s}e{*,.*} ]).first
  end
end

def paths_for_attribute(attribute, include_dirs = false)

Returns:
  • (Array) - the paths.

Parameters:
  • attribute (Symbol) --
def paths_for_attribute(attribute, include_dirs = false)
  file_patterns = spec_consumer.send(attribute)
  options = {
    :exclude_patterns => spec_consumer.exclude_files,
    :dir_pattern => glob_for_attribute(attribute),
    :include_dirs => include_dirs,
  }
  expanded_paths(file_patterns, options)
end

def platform_name

Returns:
  • (Specification) - the platform used to consume the specification.
def platform_name
  spec_consumer.platform_name
end

def prefix_header

Returns:
  • (Pathname) - The of the prefix header file of the specification.
def prefix_header
  if spec_consumer.prefix_header_file
    path_list.root + spec_consumer.prefix_header_file
  end
end

def preserve_paths

Returns:
  • (Array) - the files of the specification to preserve.
def preserve_paths
  paths_for_attribute(:preserve_paths, true)
end

def public_headers

Returns:
  • (Array) - the public headers of the specification.
def public_headers
  public_headers = paths_for_attribute(:public_header_files)
  private_headers = paths_for_attribute(:private_header_files)
  if public_headers.nil? || public_headers.empty?
    header_files = headers
  else
    header_files = public_headers
  end
  header_files - private_headers
end

def readme

Returns:
  • (Pathname) - The path of the auto-detected README file.
def readme
  path_list.glob(%w[ readme{*,.*} ]).first
end

def resource_bundle_files

Returns:
  • (Array) - The paths of the files which should be
def resource_bundle_files
  resource_bundles.values.flatten
end

def resource_bundles

Returns:
  • (Hash{String => Array}) - A hash that describes the
def resource_bundles
  result = {}
  spec_consumer.resource_bundles.each do |name, file_patterns|
    paths = expanded_paths(file_patterns, :include_dirs => true)
    result[name] = paths
  end
  result
end

def resources

Returns:
  • (Hash{ Symbol => Array }) - the resources of the
def resources
  paths_for_attribute(:resources, true)
end

def root

Returns:
  • (Pathname) - the directory which contains the files of the Pod.
def root
  path_list.root if path_list
end

def source_files

Returns:
  • (Array) - the source files of the specification.
def source_files
  paths_for_attribute(:source_files)
end

def spec

Returns:
  • (Specification) - the specification.
def spec
  spec_consumer.spec
end

def vendored_frameworks

Returns:
  • (Array) - The paths of the framework bundles that come
def vendored_frameworks
  paths_for_attribute(:vendored_frameworks, true)
end

def vendored_libraries

Returns:
  • (Array) - The paths of the library bundles that come
def vendored_libraries
  paths_for_attribute(:vendored_libraries)
end