Class: Nanoc::CLI::Commands::Prune

Inherits:
Nanoc::CLI::CommandRunner show all
Defined in:
lib/nanoc/cli/commands/prune.rb

Instance Method Summary (collapse)

Methods inherited from Nanoc::CLI::CommandRunner

#call, call, #debug?, #is_in_site_dir?, #load_site, #require_site, #site

Instance Method Details

- (Object) run



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/nanoc/cli/commands/prune.rb', line 21

def run
  load_site

  if options.key?(:yes)
    Nanoc::Extra::Pruner.new(site, :exclude => prune_config_exclude).run
  elsif options.key?(:dry-run')
    Nanoc::Extra::Pruner.new(site, :exclude => prune_config_exclude, :dry_run => true).run
  else
    $stderr.puts 'WARNING: Since the prune command is a destructive command, it requires an additional --yes flag in order to work.'
    $stderr.puts
    $stderr.puts 'Please ensure that the output directory does not contain any files (such as images or stylesheets) that are necessary but are not managed by nanoc. If you want to get a list of all files that would be removed, pass --dry-run.'
    exit 1
  end
end