Class: Pod::Generator::ModuleMap

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods/generator/module_map.rb

Overview

Generates LLVM module map files. A module map file is generated for each Pod and for each Pod target definition that is built as a framework. It specifies a different umbrella header than usual to avoid name conflicts with existing headers of the podspec.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ ModuleMap

Initialize a new instance

Parameters:



17
18
19
# File 'lib/cocoapods/generator/module_map.rb', line 17

def initialize(target)
  @target = target
end

Instance Attribute Details

#targetPodTarget (readonly)

Returns the target represented by this Info.plist.

Returns:

  • (PodTarget)

    the target represented by this Info.plist.



11
12
13
# File 'lib/cocoapods/generator/module_map.rb', line 11

def target
  @target
end

Instance Method Details

#generateString

Generates the contents of the module.modulemap file.

Returns:

  • (String)


39
40
41
42
43
44
45
46
47
48
# File 'lib/cocoapods/generator/module_map.rb', line 39

def generate
  <<-MODULE_MAP.strip_heredoc
    framework module #{target.product_module_name} {
      umbrella header "#{target.umbrella_header_path.basename}"

      export *
      module * { export * }
    }
  MODULE_MAP
end

#save_as(path) ⇒ void

This method returns an undefined value.

Generates and saves the Info.plist to the given path.

Parameters:

  • path (Pathname)

    the path where the prefix header should be stored.



28
29
30
31
32
33
# File 'lib/cocoapods/generator/module_map.rb', line 28

def save_as(path)
  contents = generate
  path.open('w') do |f|
    f.write(contents)
  end
end