Class: FileManager

Inherits:
Object
  • Object
show all
Includes:
FileHelper
Defined in:
lib/file_manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FileHelper

#compare, #fdiff_stat, #print_context

Constructor Details

#initialize(branch) ⇒ FileManager

Returns a new instance of FileManager.



13
14
15
16
# File 'lib/file_manager.rb', line 13

def initialize(branch)
  @branch = branch
  @vfs = VirtualFileSystem.new()
end

Instance Attribute Details

#vfsObject (readonly)

Returns the value of attribute vfs.



11
12
13
# File 'lib/file_manager.rb', line 11

def vfs
  @vfs
end

Instance Method Details

#apply!(commits, meta) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/file_manager.rb', line 18

def apply!(commits, meta)
  vfs.load!(commits, meta)
    .each do |commit|
      # TODO: Won't work for first commit...
      coverage = meta[:coverage].get_report(commit.id, @vfs.file_paths)
      errors = meta[:errors]&.get_errors!(commit) || []
      apply_commit!(commit, errors, coverage)
      Cache.index_commit(@branch, commit.id)
    end
end