Method: Awestruct::Dependencies#persist!

Defined in:
lib/awestruct/dependencies.rb

#persist!Object



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/awestruct/dependencies.rb', line 152

def persist!
  return if  page.output_path.nil? || page.output_path == ''
  file = File.join( @page.site.config.dir.to_s, '.awestruct', 'dependency-cache', page.output_path )
  $LOG.debug "store #{file}" if $LOG.debug?
  FileUtils.mkdir_p( File.dirname( file ) )
  File.open( file, 'w' ) do |file|
    file.puts "ch:#{@content_hash}"
    file.puts "kh:#{@key_hash}"
    @dependencies.collect{|e| e.relative_source_path }.uniq.each do |d|
      file.puts "c:#{d}" unless d.nil?
    end
    @key_dependencies.collect{|e| e.relative_source_path }.uniq.each do |d|
      file.puts "k:#{d}" unless d.nil?
    end
  end
end