class TrustyCms::TaskSupport
def cache_files(dir, files, cache_file)
Write the combined content of files in dir into cache_file in the same dir.
def cache_files(dir, files, cache_file) cache_content = files.collect do |f| File.read(File.join(dir, f)) end .join("\n\n") cache_path = File.join(dir, cache_file) File.delete(cache_path) if File.exists?(cache_path) File.open(cache_path, 'w+') { |f| f.write(cache_content) } end