Sha256: 72a5c9ef3b38fd1d35b0172379d861c9e805aa730f3d282cd3e31b6c03eef355
Contents?: true
Size: 1.23 KB
Versions: 8
Compression:
Stored size: 1.23 KB
Contents
# frozen_string_literal: true module Nanoc module Int class Compiler module Stages class Cleanup < Nanoc::Int::Compiler::Stage def initialize(output_dirs) @output_dirs = output_dirs end def run cleanup_temps(Nanoc::Filter::TMP_BINARY_ITEMS_DIR) cleanup_temps(Nanoc::Int::ItemRepWriter::TMP_TEXT_ITEMS_DIR) cleanup_unused_stores cleanup_old_stores end private def cleanup_temps(dir) Nanoc::Core::TempFilenameFactory.instance.cleanup(dir) end def cleanup_unused_stores used_paths = @output_dirs.map { |d| Nanoc::Int::Store.tmp_path_prefix(d) } all_paths = Dir.glob('tmp/nanoc/*') (all_paths - used_paths).each do |obsolete_path| FileUtils.rm_rf(obsolete_path) end end def cleanup_old_stores %w[checksums compiled_content dependencies outdatedness action_sequence].each do |fn| full_fn = File.join('tmp', fn) if File.file?(full_fn) FileUtils.rm_f(full_fn) end end end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems