Class: HMap::Target::FrameworkVFS

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-hmap/framework/framework_vfs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entrys = []) ⇒ FrameworkVFS

Returns a new instance of FrameworkVFS.



56
57
58
# File 'lib/cocoapods-hmap/framework/framework_vfs.rb', line 56

def initialize(entrys = [])
  @entrys = entrys
end

Instance Attribute Details

#entrysObject (readonly)

Returns the value of attribute entrys.



54
55
56
# File 'lib/cocoapods-hmap/framework/framework_vfs.rb', line 54

def entrys
  @entrys
end

Instance Method Details

#vfs_pathObject



60
61
62
63
64
65
66
67
68
# File 'lib/cocoapods-hmap/framework/framework_vfs.rb', line 60

def vfs_path
  return {} if entrys.empty?

  entrys.each_with_object({}) do |entry, paths|
    c = "#{entry.configuration}-#{entry.platform}"
    paths[c] ||= []
    paths[c] << entry
  end
end

#vfs_path_by_platform_and_configuration(platform, config) ⇒ Object



70
71
72
73
74
75
76
# File 'lib/cocoapods-hmap/framework/framework_vfs.rb', line 70

def vfs_path_by_platform_and_configuration(platform, config)
  return vfs_path if platform.nil? && config.nil?

  key = platform if config.nil?
  key = config if platform.nil?
  vfs_path.select { |k, _| k.include?(key) }
end

#write(path = nil) ⇒ Object



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/cocoapods-hmap/framework/framework_vfs.rb', line 78

def write(path = nil)
  vfs_path.each do |key, values|
    es = values.map do |value|
      headers_real_paths = value.headers_real_paths
      modules_real_paths = value.modules_real_paths
      VFS::FileCollectorEntry.new(Pathname(value.app_build_dir), modules_real_paths, headers_real_paths)
    end
    fc = VFS::FileCollector.new(es)
    pa = Helper::Pods.vfs_files_dir.join(key)
    pa = File.join(path, key) unless path.nil?
    pa = Pathname(pa)
    pa.mkpath unless pa.exist?
    fc.write_mapping(pa)
  end
end