cacheinator.rb 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. class Cacheinator
  2. constructor :cacheinator_helper, :file_path_utils, :file_wrapper, :yaml_wrapper
  3. def cache_test_config(hash)
  4. @yaml_wrapper.dump( @file_path_utils.form_test_build_cache_path( INPUT_CONFIGURATION_CACHE_FILE), hash )
  5. end
  6. def cache_release_config(hash)
  7. @yaml_wrapper.dump( @file_path_utils.form_release_build_cache_path( INPUT_CONFIGURATION_CACHE_FILE ), hash )
  8. end
  9. def diff_cached_test_file( filepath )
  10. cached_filepath = @file_path_utils.form_test_build_cache_path( filepath )
  11. if (@file_wrapper.exist?( cached_filepath ) and (!@file_wrapper.compare( filepath, cached_filepath )))
  12. @file_wrapper.cp(filepath, cached_filepath, {:preserve => false})
  13. return filepath
  14. elsif (!@file_wrapper.exist?( cached_filepath ))
  15. @file_wrapper.cp(filepath, cached_filepath, {:preserve => false})
  16. return filepath
  17. end
  18. return cached_filepath
  19. end
  20. def diff_cached_test_config?(hash)
  21. cached_filepath = @file_path_utils.form_test_build_cache_path(INPUT_CONFIGURATION_CACHE_FILE)
  22. return @cacheinator_helper.diff_cached_config?( cached_filepath, hash )
  23. end
  24. def diff_cached_release_config?(hash)
  25. cached_filepath = @file_path_utils.form_release_build_cache_path(INPUT_CONFIGURATION_CACHE_FILE)
  26. return @cacheinator_helper.diff_cached_config?( cached_filepath, hash )
  27. end
  28. end