Class: Jekyll::Commands::Clean

Inherits:
Jekyll::Command show all
Defined in:
lib/jekyll/commands/clean.rb

Class Method Summary collapse

Methods inherited from Jekyll::Command

add_build_options, configuration_from_options, inherited, process_site, subclasses

Class Method Details

.init_with_program(prog) ⇒ Object


6
7
8
9
10
11
12
13
14
15
# File 'lib/jekyll/commands/clean.rb', line 6

def init_with_program(prog)
  prog.command(:clean) do |c|
    c.syntax 'clean [subcommand]'
    c.description 'Clean the site (removes site output and metadata file) without building.'

    c.action do |args, _|
      Jekyll::Commands::Clean.process({})
    end
  end
end

.process(options) ⇒ Object


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/jekyll/commands/clean.rb', line 17

def process(options)
  options = configuration_from_options(options)
  destination = options['destination']
   = File.join(options['source'], '.jekyll-metadata')

  if File.directory? destination
    Jekyll.logger.info "Cleaning #{destination}..."
    FileUtils.rm_rf(destination)
    Jekyll.logger.info "", "done."
  else
    Jekyll.logger.info "Nothing to do for #{destination}."
  end

  if File.file? 
    Jekyll.logger.info "Removing #{}..."
    FileUtils.rm_rf()
    Jekyll.logger.info "", "done."
  else
    Jekyll.logger.info "Nothing to do for #{}."
  end
end