Class: HMap::Target::FrameworkVFS

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

Overview

A collection of Each FrameworkEntrys

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entrys = []) ⇒ FrameworkVFS

Returns a new instance of FrameworkVFS.



58
59
60
# File 'lib/hmap/framework/framework_vfs.rb', line 58

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

Instance Attribute Details

#entrysObject (readonly)

Returns the value of attribute entrys.



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

def entrys
  @entrys
end

Instance Method Details

#vfs_pathObject



62
63
64
65
66
67
68
69
70
# File 'lib/hmap/framework/framework_vfs.rb', line 62

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



72
73
74
75
76
77
78
# File 'lib/hmap/framework/framework_vfs.rb', line 72

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) ⇒ Object



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

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