class Yoda::Store::Actions::ReadProjectFiles

Attributes

registry[R]

@return [Registry]

root_path[R]

@return [String]

Public Class Methods

new(registry, root_path) click to toggle source
# File lib/yoda/store/actions/read_project_files.rb, line 11
def initialize(registry, root_path)
  @registry = registry
  @root_path = root_path
end

Public Instance Methods

run() click to toggle source
# File lib/yoda/store/actions/read_project_files.rb, line 16
def run
  files = project_files
  progress = Instrument::Progress.new(files.length) do |index:, length:|
    Instrument.instance.initialization_progress(phase: :load_project_files, message: "Loading current project files (#{index} / #{length})", index: index, length: length)
  end

  files.each do |file|
    ReadFile.run(registry, file)
    progress.increment
  end
end

Private Instance Methods

project_files() click to toggle source

@return [Array<String>]

# File lib/yoda/store/actions/read_project_files.rb, line 31
def project_files
  Dir.chdir(root_path) { Dir.glob("{lib,app}/**/*.rb\0ext/**/*.c\0.yoda/*.rb").map { |name| File.expand_path(name, root_path) } }
end