Sha256: 79d3b029b68afc0658a285d51a12f4d4ac3a43f0edc691797806a613823c88c8

Contents?: true

Size: 1.21 KB

Versions: 8

Compression:

Stored size: 1.21 KB

Contents

module Jekyll
  module Commands
    class Clean < Command
      class << self

        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

        def process(options)
          options = configuration_from_options(options)
          destination = options['destination']
          metadata_file = 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? metadata_file
            Jekyll.logger.info "Removing #{metadata_file}..."
            FileUtils.rm_rf(metadata_file)
            Jekyll.logger.info "", "done."
          else
            Jekyll.logger.info "Nothing to do for #{metadata_file}."
          end
        end

      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
jekyll-3.0.0.pre.beta8 lib/jekyll/commands/clean.rb
jekyll-3.0.0.pre.beta7 lib/jekyll/commands/clean.rb
jekyll-3.0.0.pre.beta6 lib/jekyll/commands/clean.rb
jekyll-3.0.0.pre.beta5 lib/jekyll/commands/clean.rb
jekyll-3.0.0.pre.beta4 lib/jekyll/commands/clean.rb
jekyll-3.0.0.pre.beta3 lib/jekyll/commands/clean.rb
jekyll-3.0.0.pre.beta2 lib/jekyll/commands/clean.rb
jekyll-3.0.0.pre.beta1 lib/jekyll/commands/clean.rb