Class: Nanoc::CLI::Commands::Compile

Inherits:
Nanoc::CLI::CommandRunner show all
Extended by:
Memoization
Defined in:
lib/nanoc/cli/commands/compile.rb

Defined Under Namespace

Classes: DebugPrinter, DiffGenerator, FileActionPrinter, GCController, Listener, TimingRecorder

Instance Method Summary (collapse)

Methods included from Memoization

memoize

Methods inherited from Nanoc::CLI::CommandRunner

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

Constructor Details

- (Compile) initialize(options, arguments, command, params = {})

Returns a new instance of Compile



384
385
386
387
# File 'lib/nanoc/cli/commands/compile.rb', line 384

def initialize(options, arguments, command, params = {})
  super(options, arguments, command)
  @listener_classes = params.fetch(:listener_classes, default_listener_classes)
end

Instance Method Details

- (Object) run



389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
# File 'lib/nanoc/cli/commands/compile.rb', line 389

def run
  time_before = Time.now

  load_site
  check_for_deprecated_usage

  puts 'Compiling site…'
  run_listeners_while do
    site.compile
    prune
  end

  time_after = Time.now
  puts
  puts "Site compiled in #{format('%.2f', time_after - time_before)}s."
end