preprocessinator_file_handler.rb 746 B

123456789101112131415161718192021
  1. class PreprocessinatorFileHandler
  2. constructor :preprocessinator_extractor, :configurator, :tool_executor, :file_path_utils, :file_wrapper
  3. def preprocess_file(filepath, includes)
  4. preprocessed_filepath = @file_path_utils.form_preprocessed_file_filepath(filepath)
  5. command = @tool_executor.build_command_line(@configurator.tools_test_file_preprocessor, filepath, preprocessed_filepath)
  6. @tool_executor.exec(command[:line], command[:options])
  7. contents = @preprocessinator_extractor.extract_base_file_from_preprocessed_expansion(preprocessed_filepath)
  8. includes.each{|include| contents.unshift("#include \"#{include}\"")}
  9. @file_wrapper.write(preprocessed_filepath, contents.join("\n"))
  10. end
  11. end