class Pod::Installer::FileReferencesInstaller


specifications in the Pods project.
Controller class responsible of installing the file references of the

def add_file_accessors_paths_to_pods_group(file_accessor_key, group_key = nil)

Returns:
  • (void) -

Parameters:
  • group_key (Symbol) --
  • file_accessor_key (Symbol) --
def add_file_accessors_paths_to_pods_group(file_accessor_key, group_key = nil)
  file_accessors.each do |file_accessor|
    paths = file_accessor.send(file_accessor_key)
    paths.each do |path|
      group = pods_project.group_for_spec(file_accessor.spec.name, group_key)
      pods_project.add_file_reference(path, group)
    end
  end
end

def add_frameworks_bundles

Returns:
  • (void) -
def add_frameworks_bundles
  UI.message "- Adding frameworks to Pods project" do
    add_file_accessors_paths_to_pods_group(:vendored_frameworks, :frameworks)
  end
end

def add_resources

Returns:
  • (void) -

Other tags:
    Note: - The source files are grouped by Pod and in turn by subspec
def add_resources
  UI.message "- Adding resources to Pods project" do
    add_file_accessors_paths_to_pods_group(:resources, :resources)
    add_file_accessors_paths_to_pods_group(:resource_bundle_files, :resources)
  end
end

def add_source_files_references

Returns:
  • (void) -

Other tags:
    Note: - The source files are grouped by Pod and in turn by subspec
def add_source_files_references
  UI.message "- Adding source files to Pods project" do
    add_file_accessors_paths_to_pods_group(:source_files)
  end
end

def add_vendored_libraries

Returns:
  • (void) -
def add_vendored_libraries
  UI.message "- Adding libraries to Pods project" do
    add_file_accessors_paths_to_pods_group(:vendored_libraries, :frameworks)
  end
end

def file_accessors

Returns:
  • (Array) - The file accessors for all the
def file_accessors
  @file_accessors ||= libraries.map(&:file_accessors).flatten.compact
end

def header_mappings(headers_sandbox, file_accessor, headers)

Returns:
  • (Hash{Pathname => Array}) - A hash containing the

Parameters:
  • headers (Array) --
  • consumer (Specification::Consumer) --
  • headers_sandbox (Pathname) --
def header_mappings(headers_sandbox, file_accessor, headers)
  consumer = file_accessor.spec_consumer
  dir = headers_sandbox
  dir = dir + consumer.header_dir if consumer.header_dir
  mappings = {}
  headers.each do |header|
    sub_dir = dir
    if consumer.header_mappings_dir
      header_mappings_dir = file_accessor.path_list.root + consumer.header_mappings_dir
      relative_path = header.relative_path_from(header_mappings_dir)
      sub_dir = sub_dir + relative_path.dirname
    end
    mappings[sub_dir] ||= []
    mappings[sub_dir] << header
  end
  mappings
end

def initialize(sandbox, libraries, pods_project)

Parameters:
  • libraries (Project) -- @see libraries
  • libraries (Array) -- @see libraries
  • sandbox (Sandbox) -- @see sandbox
def initialize(sandbox, libraries, pods_project)
  @sandbox = sandbox
  @libraries = libraries
  @pods_project = pods_project
end

def install!

Returns:
  • (void) -
def install!
  refresh_file_accessors
  add_source_files_references
  add_frameworks_bundles
  add_vendored_libraries
  add_resources
  link_headers
end

def link_headers

Returns:
  • (void) -
def link_headers
  UI.message "- Linking headers" do
    libraries.each do |library|
      library.file_accessors.each do |file_accessor|
        headers_sandbox = Pathname.new(file_accessor.spec.root.name)
        library.build_headers.add_search_path(headers_sandbox)
        sandbox.public_headers.add_search_path(headers_sandbox)
        header_mappings(headers_sandbox, file_accessor, file_accessor.headers).each do |namespaced_path, files|
          library.build_headers.add_files(namespaced_path, files)
        end
        header_mappings(headers_sandbox, file_accessor, file_accessor.public_headers).each do |namespaced_path, files|
          sandbox.public_headers.add_files(namespaced_path, files)
        end
      end
    end
  end
end

def refresh_file_accessors

Returns:
  • (void) -

Other tags:
    Note: - The contents of the file accessors are modified by the clean
def refresh_file_accessors
  file_accessors.each do |fa|
    fa.path_list.read_file_system
  end
end