Class: SorbetView::FileSystem::ProjectScanner

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/sorbet_view/file_system/project_scanner.rb

Class Method Summary collapse

Class Method Details

.scan(config) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/sorbet_view/file_system/project_scanner.rb', line 10

def self.scan(config)
  Perf.measure('scanner.scan_templates') do
    config.input_dirs.flat_map do |dir|
      Dir.glob(File.join(dir, '**', '*.erb'))
    end.reject do |path|
      config.exclude_paths.any? { |ex| path.start_with?(ex) }
    end.sort
  end
end

.scan_components(config) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/sorbet_view/file_system/project_scanner.rb', line 21

def self.scan_components(config)
  Perf.measure('scanner.scan_components') do
    config.component_dirs.flat_map do |dir|
      Dir.glob(File.join(dir, '**', '*.rb'))
    end.reject do |path|
      config.exclude_paths.any? { |ex| path.start_with?(ex) }
    end.select do |path|
      File.read(path).include?('erb_template')
    end.sort
  end
end