yaml-vfs 0.0.2 → 0.0.3

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: bb77a02e5dff7b58ddbb164d61e7b1ffd1ffdd0ec0ddf816aaf6189462de0105
4
- data.tar.gz: aea8cbd0ffb9eed48a942edc211fcbbc6378b1047aa72ff63e389dd31d513702
3
+ metadata.gz: 563791b343561d3ba0e548e099d21343a312290e6168e7021c71c76bfc47f785
4
+ data.tar.gz: 00fbb4e8b8f040e8d83876f7c22dd297e2ea49c555d1710daa9b3f486457e4ed
5
5
  SHA512:
6
- metadata.gz: b6962cb728e59c07c08c00276a80a489b1707b3239c2d037d743159e04f907bbea961504944fb9b60b268b70e589e0bbcdf890d701eb5fa1aad5747d1339a03e
7
- data.tar.gz: ad4386f7f3fb7d9c3643bb525de459b93a0c99b848226c34de64c15c1266ff40fb479d1f8e97408d8ae4813a804ea3044d5bb2ad5e2f1b9573106d988a65f706
6
+ metadata.gz: a1da9ac68ecfd753d4e51c013d7ff0f36cc4c506d259ed911dab334392fbde68ec2b8a00abb66332a1b6e0ac6f3df3bcb09aee3347f95a686bb1ce888db35578
7
+ data.tar.gz: cc0eefdb0598185f80861f68d93e71fcdb092c4eaf713c06bf49b9bd8d03eb0f110d3c8158fb34a9e87fabb09efb32df4dfe0121c7a687c1cdac8989a1bd6d59
@@ -51,7 +51,8 @@ module VFS
51
51
  def run
52
52
  require 'yaml_vfs'
53
53
 
54
- VFS::FileCollector.new_from_real_headers_dir(@framework_path, @real_modules_dir, @real_header_dir).write_mapping(@output_path)
54
+ entry = VFS::FileCollectorEntry.new_from_real_headers_dir(@framework_path, @real_modules_dir, @real_header_dir)
55
+ VFS::FileCollector.new([entry]).write_mapping(@output_path)
55
56
  end
56
57
  end
57
58
  end
@@ -1,17 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'set'
4
- require 'yaml-vfs/yaml_vfs'
5
4
 
6
5
  module VFS
7
- # vfs gen
8
- class FileCollector
9
- HEADER_FILES_EXTENSIONS = %w[.h .hh .hpp .ipp .tpp .hxx .def .inl .inc].freeze
6
+ HEADER_FILES_EXTENSIONS = %w[.h .hh .hpp .ipp .tpp .hxx .def .inl .inc].freeze
7
+
8
+ # vfs file collector entry
9
+ class FileCollectorEntry
10
10
 
11
11
  attr_reader :framework_path, :real_modules, :real_headers
12
12
 
13
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
+ raise ArgumentError, 'real_modules_dir must set and exist' if real_modules_dir.nil? || !real_modules_dir.exist?
15
16
 
16
17
  files = Pathname.glob(Pathname(real_header_dir).join('**').join('*')).select do |file|
17
18
  HEADER_FILES_EXTENSIONS.include?(file.extname)
@@ -21,17 +22,25 @@ module VFS
21
22
  end
22
23
 
23
24
  def initialize(framework_path, real_modules, real_headers)
24
- @seen = Set.new
25
- @vfs_writer = YAMLVFSWriter.new
25
+ raise ArgumentError, 'framework_path must set' if framework_path.nil?
26
+ raise ArgumentError, 'real_modules and real_headers must set' if real_modules.empty?
27
+
26
28
  @real_headers = real_headers
27
29
  @framework_path = Pathname(framework_path)
28
30
  @real_modules = real_modules
29
31
  end
32
+ end
30
33
 
31
- def write_mapping(name)
32
- raise ArgumentError, 'framework_path must set' if @framework_path.nil?
33
- raise ArgumentError, 'real_headers or real_header_dir one of them must set' if @real_headers.empty?
34
+ # vfs gen
35
+ class FileCollector
36
+ def initialize(entry)
37
+ raise ArgumentError, 'entry must not empty' if entry.empty?
38
+
39
+ @entry = entry
40
+ @vfs_writer = YAMLVFSWriter.new
41
+ end
34
42
 
43
+ def write_mapping(name)
35
44
  add_write_file
36
45
  @vfs_writer.case_sensitive = false
37
46
  path = Pathname(name).expand_path
@@ -44,15 +53,19 @@ module VFS
44
53
  private
45
54
 
46
55
  def add_write_file
47
- wirte_f = lambda { |dir, files|
48
- paths = @framework_path.join(dir)
56
+ wirte_f = lambda { |framework_path, dir, files|
57
+ return if dir.empty?
58
+
59
+ paths = framework_path.join(dir)
49
60
  files.each do |file|
50
61
  path = paths.join(file.basename)
51
62
  @vfs_writer.add_file_mapping(path, file)
52
63
  end
53
64
  }
54
- wirte_f.call('Headers', real_headers) unless real_headers.empty?
55
- wirte_f.call('Modules', real_modules) unless real_modules.empty?
65
+ @entry.each do |entry|
66
+ wirte_f.call(entry.framework_path, 'Headers', entry.real_headers)
67
+ wirte_f.call(entry.framework_path, 'Modules', entry.real_modules)
68
+ end
56
69
  end
57
70
  end
58
71
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module VFS
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.3'
5
5
  end
data/lib/yaml_vfs.rb CHANGED
@@ -16,10 +16,10 @@ module VFS
16
16
  end
17
17
  end
18
18
 
19
+ require_relative 'yaml-vfs/yaml_vfs'
19
20
  require_relative 'yaml-vfs/version'
20
21
  require_relative 'yaml-vfs/utils'
22
+ require_relative 'yaml-vfs/file_collector'
21
23
 
22
-
23
- autoload :FileCollector, 'yaml-vfs/file_collector'
24
24
  autoload :Command, 'yaml-vfs/command'
25
25
  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.2
4
+ version: 0.0.3
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-07 00:00:00.000000000 Z
11
+ date: 2021-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler