Class: Yoda::Store::Actions::ReadProjectFiles

Inherits:
Object
  • Object
show all
Defined in:
lib/yoda/store/actions/read_project_files.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project, registry) ⇒ ReadProjectFiles

Returns a new instance of ReadProjectFiles.

Parameters:



19
20
21
22
# File 'lib/yoda/store/actions/read_project_files.rb', line 19

def initialize(project, registry)
  @project = project
  @registry = registry
end

Instance Attribute Details

#projectProject (readonly)

Returns:



6
7
8
# File 'lib/yoda/store/actions/read_project_files.rb', line 6

def project
  @project
end

#registryRegistry (readonly)

Returns:



9
10
11
# File 'lib/yoda/store/actions/read_project_files.rb', line 9

def registry
  @registry
end

Class Method Details

.for_project(project) ⇒ ReadProjectFiles

Parameters:

Returns:



13
14
15
# File 'lib/yoda/store/actions/read_project_files.rb', line 13

def self.for_project(project)
  new(project, project.registry)
end

Instance Method Details

#runObject



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/yoda/store/actions/read_project_files.rb', line 24

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