Sha256: 45f330500c57885f8aa5b8747c34b5dd45642867b18c90850ac576b27e8e7bcf

Contents?: true

Size: 1.88 KB

Versions: 2

Compression:

Stored size: 1.88 KB

Contents

# =========================================================================
#   Ceedling - Test-Centered Build System for C
#   ThrowTheSwitch.org
#   Copyright (c) 2010-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
#   SPDX-License-Identifier: MIT
# =========================================================================

class Cacheinator

  constructor :cacheinator_helper, :file_path_utils, :file_wrapper, :yaml_wrapper
  
  def cache_test_config(hash)
    @yaml_wrapper.dump( @file_path_utils.form_test_build_cache_path( INPUT_CONFIGURATION_CACHE_FILE), hash )
  end

  def cache_release_config(hash)
    @yaml_wrapper.dump( @file_path_utils.form_release_build_cache_path( INPUT_CONFIGURATION_CACHE_FILE ), hash )
  end

  
  def diff_cached_test_file( filepath )
    cached_filepath = @file_path_utils.form_test_build_cache_path( filepath )
  
    if (@file_wrapper.exist?( cached_filepath ) and (!@file_wrapper.compare( filepath, cached_filepath )))
      @file_wrapper.cp(filepath, cached_filepath, {:preserve => false})
      return filepath
    elsif (!@file_wrapper.exist?( cached_filepath ))
      @file_wrapper.cp(filepath, cached_filepath, {:preserve => false}) 
      return filepath
    end

    return cached_filepath
  end

  def diff_cached_test_config?(hash)
    cached_filepath = @file_path_utils.form_test_build_cache_path(INPUT_CONFIGURATION_CACHE_FILE)

    return @cacheinator_helper.diff_cached_config?( cached_filepath, hash )
  end

  def diff_cached_test_defines?(files)
    cached_filepath = @file_path_utils.form_test_build_cache_path(DEFINES_DEPENDENCY_CACHE_FILE)

    return @cacheinator_helper.diff_cached_defines?( cached_filepath, files )
  end

  def diff_cached_release_config?(hash)
    cached_filepath = @file_path_utils.form_release_build_cache_path(INPUT_CONFIGURATION_CACHE_FILE)

    return @cacheinator_helper.diff_cached_config?( cached_filepath, hash )
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ceedling-1.0.1 lib/ceedling/cacheinator.rb
ceedling-1.0.0 lib/ceedling/cacheinator.rb