Class: CacheinatorHelper

Inherits:
Object show all
Defined in:
lib/ceedling/cacheinator_helper.rb

Instance Method Summary collapse

Instance Method Details

#diff_cached_config?(cached_filepath, hash) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
# File 'lib/ceedling/cacheinator_helper.rb', line 6

def diff_cached_config?(cached_filepath, hash)
  return false if ( not @file_wrapper.exist?(cached_filepath) )
  return true if (@yaml_wrapper.load(cached_filepath) != hash)
  return false
end

#diff_cached_defines?(cached_filepath, files) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ceedling/cacheinator_helper.rb', line 12

def diff_cached_defines?(cached_filepath, files)
  current_defines = COLLECTION_DEFINES_TEST_AND_VENDOR.reject(&:empty?)

  current_dependency = Hash[files.collect { |source| [source, current_defines.dup] }]
  if not @file_wrapper.exist?(cached_filepath)
    @yaml_wrapper.dump(cached_filepath, current_dependency)
    return false
  end

  dependencies = @yaml_wrapper.load(cached_filepath)
  if dependencies.values_at(*current_dependency.keys) != current_dependency.values
    dependencies.merge!(current_dependency)
    @yaml_wrapper.dump(cached_filepath, dependencies)
    return true
  end

  return false
end