Module: FactorySloth::FileProcessor

Extended by:
FileProcessor
Included in:
FileProcessor
Defined in:
lib/factory_sloth/file_processor.rb

Instance Method Summary collapse

Instance Method Details

#call(files:, forced_files: []) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/factory_sloth/file_processor.rb', line 5

def call(files:, forced_files: [])
  files.each_with_object({}) do |path, acc|
    if DoneTracker.done?(path) &&
       !(FactorySloth.force || forced_files.include?(path))
      puts "🔵 #{path}: skipped (marked as done in #{DoneTracker.file})", ''
      next
    end

    result = process(path)
    acc[path] = { ok: result.ok?, change_count: result.change_count }
    DoneTracker.mark_as_done(path)
  end
end