class XcodeArchiveCache::Modulemap::HeaderPathExtractor

Public Instance Methods

extract_all_paths(modulemap_path) click to toggle source

@param [String] modulemap_path

@return [Array<String>]

# File lib/modulemap/header_path_extractor.rb, line 29
def extract_all_paths(modulemap_path)
  modulemap_dir = File.dirname(modulemap_path)
  modulemap_lines = FileHandler.new.read_modulemap_lines(modulemap_path)
  header_paths = []

  modulemap_lines.each do |line|
    header_declaration = extract_header_declaration(line)
    if header_declaration
      header_paths << get_full_header_path(modulemap_dir, header_declaration.path)
    end
  end

  debug("modulemap header paths: #{header_paths}")

  header_paths
end
extract_header_declaration(line) click to toggle source

@param [String] line

@return [XcodeArchiveCache::Modulemap::HeaderPathDeclaration]

# File lib/modulemap/header_path_extractor.rb, line 59
def extract_header_declaration(line)
  if line.include?("header") && !line.include?("exclude")
    components = line.split("\"")
    HeaderPathDeclaration.new(components[0], components[1])
  end
end
get_full_header_path(modulemap_dir, path) click to toggle source

@param [String] modulemap_dir @param [String] path

@return [String]

# File lib/modulemap/header_path_extractor.rb, line 51
def get_full_header_path(modulemap_dir, path)
  Pathname.new(path).absolute? ? path : File.join(modulemap_dir, path)
end