class Bridgetown::Commands::Clean

Public Class Methods

banner() click to toggle source

Public Instance Methods

clean() click to toggle source
# File lib/bridgetown-core/commands/clean.rb, line 19
def clean
  config = configuration_with_overrides(options)
  destination = config["destination"]
  metadata_file = File.join(config["root_dir"], ".bridgetown-metadata")
  cache_dir = File.join(config["root_dir"], config["cache_dir"])
  webpack_dir = File.join(config["root_dir"], ".bridgetown-webpack")

  remove(destination, checker_func: :directory?)
  remove(metadata_file, checker_func: :file?)
  remove(cache_dir, checker_func: :directory?)
  remove(webpack_dir, checker_func: :directory?)
end

Protected Instance Methods

remove(filename, checker_func: :file?) click to toggle source
# File lib/bridgetown-core/commands/clean.rb, line 34
def remove(filename, checker_func: :file?)
  if File.public_send(checker_func, filename)
    Bridgetown.logger.info "Cleaner:", "Removing #{filename}..."
    FileUtils.rm_rf(filename)
  else
    Bridgetown.logger.info "Cleaner:", "Nothing to do for #{filename}."
  end
end