Class: EasyHtmlGenerator::Generator::Delete

Inherits:
Base
  • Object
show all
Defined in:
lib/easy_html_generator/generator/delete.rb

Overview

this generator deletes in the dest folder

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods inherited from Base

#dest_path, #do_file, #do_input, #initialize, #input_to_output_file, #log, #log_running, #resolve_path_prefix, #should_do_file?, #src_path, #walk_files

Constructor Details

This class inherits a constructor from EasyHtmlGenerator::Generator::Base

Instance Method Details

#generateObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/easy_html_generator/generator/delete.rb', line 7

def generate
  return unless @config.enabled

  log_running

  @config.files.each do |file_pattern|
    resolved_pattern = resolve_path_prefix(file_pattern, @project.dist_path)
    Dir[resolved_pattern].each do |file|
      EasyHtmlGenerator::Checksum.invalidate_file file

      FileUtils.rm_rf file
    end
  end
end