yaml-vfs 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +22 -0
- data/lib/yaml-vfs/command/yaml_vfs_writer.rb +1 -1
- data/lib/yaml-vfs/file_collector.rb +12 -10
- data/lib/yaml-vfs/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb77a02e5dff7b58ddbb164d61e7b1ffd1ffdd0ec0ddf816aaf6189462de0105
|
4
|
+
data.tar.gz: aea8cbd0ffb9eed48a942edc211fcbbc6378b1047aa72ff63e389dd31d513702
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6962cb728e59c07c08c00276a80a489b1707b3239c2d037d743159e04f907bbea961504944fb9b60b268b70e589e0bbcdf890d701eb5fa1aad5747d1339a03e
|
7
|
+
data.tar.gz: ad4386f7f3fb7d9c3643bb525de459b93a0c99b848226c34de64c15c1266ff40fb479d1f8e97408d8ae4813a804ea3044d5bb2ad5e2f1b9573106d988a65f706
|
data/README.md
CHANGED
@@ -55,6 +55,28 @@ $ vfs yamlwriter --framework-path=<path> --real-headers-dir=<path> --real-module
|
|
55
55
|
- `--real-modules-dir=<path>`: real modules path
|
56
56
|
- `--output-path=<path>`: vfs yaml file output path
|
57
57
|
|
58
|
+
### Quickstart
|
59
|
+
|
60
|
+
To begin gen an yaml VFS file start by create an `FileCollector`:
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
require 'yaml_vfs'
|
64
|
+
modules = ['./module.modulemap', './module.private.modulemap']
|
65
|
+
headers_path = ['./A.h', './B.h']
|
66
|
+
vfs = VFS::FileCollector.new('./A.framework', modules, headers_path)
|
67
|
+
vfs.write_mapping('./vfs_yaml_output_path')
|
68
|
+
```
|
69
|
+
|
70
|
+
or set use path:
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
require 'yaml_vfs'
|
74
|
+
modules = ['./module.modulemap', './module.private.modulemap']
|
75
|
+
headers_path = ['./A.h', './B.h']
|
76
|
+
vfs = VFS::FileCollector.new_from_real_headers_dir('./A.framework', './module_path', './headers')
|
77
|
+
vfs.write_mapping('./vfs_yaml_output_path')
|
78
|
+
```
|
79
|
+
|
58
80
|
## Command Line Tool
|
59
81
|
|
60
82
|
Installing the 'yaml-vfs' gem will also install two command-line tool `vfs` which you can use to generate VFS YAML file.
|
@@ -51,7 +51,7 @@ module VFS
|
|
51
51
|
def run
|
52
52
|
require 'yaml_vfs'
|
53
53
|
|
54
|
-
VFS::FileCollector.new_from_real_headers_dir(@framework_path, @
|
54
|
+
VFS::FileCollector.new_from_real_headers_dir(@framework_path, @real_modules_dir, @real_header_dir).write_mapping(@output_path)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
@@ -8,23 +8,24 @@ module VFS
|
|
8
8
|
class FileCollector
|
9
9
|
HEADER_FILES_EXTENSIONS = %w[.h .hh .hpp .ipp .tpp .hxx .def .inl .inc].freeze
|
10
10
|
|
11
|
-
attr_reader :framework_path, :
|
11
|
+
attr_reader :framework_path, :real_modules, :real_headers
|
12
12
|
|
13
|
-
def self.new_from_real_headers_dir(framework_path,
|
13
|
+
def self.new_from_real_headers_dir(framework_path, real_modules_dir, real_header_dir)
|
14
14
|
raise ArgumentError, 'real_header_dir must set and exist' if real_header_dir.nil? || !real_header_dir.exist?
|
15
15
|
|
16
|
-
files = Pathname.glob(real_header_dir.join('**').join('*')).select do |file|
|
16
|
+
files = Pathname.glob(Pathname(real_header_dir).join('**').join('*')).select do |file|
|
17
17
|
HEADER_FILES_EXTENSIONS.include?(file.extname)
|
18
18
|
end
|
19
|
-
|
19
|
+
real_modules = Pathname(real_modules_dir).glob('module*.modulemap')
|
20
|
+
new(framework_path, real_modules, files)
|
20
21
|
end
|
21
22
|
|
22
|
-
def initialize(framework_path,
|
23
|
+
def initialize(framework_path, real_modules, real_headers)
|
23
24
|
@seen = Set.new
|
24
25
|
@vfs_writer = YAMLVFSWriter.new
|
25
26
|
@real_headers = real_headers
|
26
|
-
@framework_path = framework_path
|
27
|
-
@
|
27
|
+
@framework_path = Pathname(framework_path)
|
28
|
+
@real_modules = real_modules
|
28
29
|
end
|
29
30
|
|
30
31
|
def write_mapping(name)
|
@@ -33,9 +34,10 @@ module VFS
|
|
33
34
|
|
34
35
|
add_write_file
|
35
36
|
@vfs_writer.case_sensitive = false
|
36
|
-
path = name.expand_path
|
37
|
+
path = Pathname(name).expand_path
|
37
38
|
path = path.join('all-product-headers.yaml') if path.directory?
|
38
39
|
stream = @vfs_writer.write
|
40
|
+
path.dirname.mkpath
|
39
41
|
File.open(path, 'w') { |f| f.write(stream) }
|
40
42
|
end
|
41
43
|
|
@@ -49,8 +51,8 @@ module VFS
|
|
49
51
|
@vfs_writer.add_file_mapping(path, file)
|
50
52
|
end
|
51
53
|
}
|
52
|
-
wirte_f.call('Headers',
|
53
|
-
wirte_f.call('Modules',
|
54
|
+
wirte_f.call('Headers', real_headers) unless real_headers.empty?
|
55
|
+
wirte_f.call('Modules', real_modules) unless real_modules.empty?
|
54
56
|
end
|
55
57
|
end
|
56
58
|
end
|
data/lib/yaml-vfs/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaml-vfs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cat1237
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -100,8 +100,8 @@ dependencies:
|
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '3.1'
|
103
|
-
description:
|
104
|
-
|
103
|
+
description: '`vfs yamlwriter` lets you create clang opt "-ivfsoverlay" ymal file,
|
104
|
+
map virtual path to real path.'
|
105
105
|
email:
|
106
106
|
- wangson1237@outlook.com
|
107
107
|
executables:
|
@@ -141,5 +141,5 @@ requirements: []
|
|
141
141
|
rubygems_version: 3.1.6
|
142
142
|
signing_key:
|
143
143
|
specification_version: 4
|
144
|
-
summary:
|
144
|
+
summary: A gem which can gen VFS YAML file.
|
145
145
|
test_files: []
|