Class: Rawfeed::Build::Cleaner
- Inherits:
-
Object
- Object
- Rawfeed::Build::Cleaner
- Defined in:
- lib/rawfeed/build/cleaner.rb
Constant Summary collapse
- JEKYLL_CACHE_PATHS =
[ ".jekyll-metadata", ".jekyll-cache", "_site" ].freeze
- PROJECT_PATHS =
[ ".jekyll-metadata", ".jekyll-cache", "_site" ].freeze
Class Method Summary collapse
Class Method Details
.clean_jekyll_cache ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/rawfeed/build/cleaner.rb', line 21 def self.clean_jekyll_cache puts "Cleaning Jekyll cache...".yellow deleted_paths = [] JEKYLL_CACHE_PATHS.each do |path| if File.exist?(path) || Dir.exist?(path) FileUtils.rm_rf(path) deleted_paths << path end end if deleted_paths.any? puts "Items successfully removed:".green deleted_paths.each { |path| puts " - #{path}" } else puts "No items to clean." end end |
.clean_project ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/rawfeed/build/cleaner.rb', line 40 def self.clean_project puts "Cleaning up project directories and files...".yellow deleted_paths = [] PROJECT_PATHS.each do |path| if File.exist?(path) || Dir.exist?(path) FileUtils.rm_rf(path) deleted_paths << path end end if deleted_paths.any? puts "Items successfully removed:".green deleted_paths.each { |path| puts " - #{path}" } else puts "No items to clean." end end |