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



382
383
384
385
# File 'lib/nanoc/cli/commands/compile.rb', line 382

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

Instance Method Details

- (Object) run



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

def run
  time_before = Time.now

  self.load_site
  self.check_for_deprecated_usage

  puts "Compiling site…"
  self.run_listeners_while do
    self.site.compile
    self.prune
  end

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