Module: PrelandsRails::CreateSimpleSource::CheckZipFiles::DetectAbsentFiles

Included in:
PrelandsRails::CreateSimpleSource::CheckZipFiles
Defined in:
lib/prelands_rails/create_simple_source/check_zip_files/detect_absent_files.rb

Overview

Вернёт массив вида [‘index.js not found’,..] или пустой массив, если все ожидаемые файлы присутствуют в архиве с исходниками преленда

Instance Method Summary collapse

Instance Method Details

#detect_absent_files(expected_files, incoming_files) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/prelands_rails/create_simple_source/check_zip_files/detect_absent_files.rb', line 11

def detect_absent_files(expected_files, incoming_files)
  raise 'expected_files must be present' unless expected_files.present?

  # опрашиваем по списку пришедший контент
  expected_files.map do |efile|
    sought = incoming_files&.find { |ifile| ifile.ftype == efile.ftype && ifile.name == efile.name }
    if sought.nil?
      '%s not found' % efile.name
    end
  end.compact
end