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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7520f51e2e72b65619517d88bfcca217e8b7a22b8cff8f1aa54fb78fc44be93e
4
- data.tar.gz: 7175cd3d9718aa7d38a67785cf056d9f61bd205b1ddbf08089479b1ba07a0e3d
3
+ metadata.gz: bb77a02e5dff7b58ddbb164d61e7b1ffd1ffdd0ec0ddf816aaf6189462de0105
4
+ data.tar.gz: aea8cbd0ffb9eed48a942edc211fcbbc6378b1047aa72ff63e389dd31d513702
5
5
  SHA512:
6
- metadata.gz: 5b17d619dbbe74947b0040ac4afacbf27b207e785a9cacbcda365cf83ff0b243080955d2a51ac45dc295b296820389d4a8dd78ef195bb6b93d93c70a9c0a8341
7
- data.tar.gz: 1ec49fd3ee822039e2fb3ad489cd9afd7cf9a0986f1ef161c3ec0c7f522c25a66626f057522728f65e60103f0adde0aa83844aac9021609c0b80daad03e61b48
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, @real_header_dir, @real_modules_dir).write_mapping(@output_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, :real_modules_dir, :real_headers
11
+ attr_reader :framework_path, :real_modules, :real_headers
12
12
 
13
- def self.new_from_real_headers_dir(framework_path, real_header_dir, real_modules_dir)
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
- new(framework_path, real_modules_dir, files)
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, real_modules_dir, real_headers)
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
- @real_modules_dir = real_modules_dir
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', @real_headers) unless @real_headers.empty?
53
- wirte_f.call('Modules', real_modules_dir.glob('*.modulemap')) unless @real_modules_dir.nil?
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module VFS
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.2'
5
5
  end
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.1
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-01 00:00:00.000000000 Z
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: header_reader lets your read Xcode header map file. header-writer lets
104
- your analyze the project pod dependencies and gen header map file for all pods.
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: Read or write header map file.
144
+ summary: A gem which can gen VFS YAML file.
145
145
  test_files: []