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?, #in_site_dir?, #load_site, #require_site, #site

Constructor Details

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

Returns a new instance of Compile



370
371
372
373
# File 'lib/nanoc/cli/commands/compile.rb', line 370

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



375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
# File 'lib/nanoc/cli/commands/compile.rb', line 375

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