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

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

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Nanoc::CLI::CommandRunner

#call, #debug?, #in_site_dir?, #load_site, #site, #site=

Constructor Details

#initialize(options, arguments, command) ⇒ Compile

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Compile.



394
395
396
397
# File 'lib/nanoc/cli/commands/compile.rb', line 394

def initialize(options, arguments, command)
  super
  @listener_classes = default_listener_classes
end

Instance Attribute Details

#listener_classesObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



392
393
394
# File 'lib/nanoc/cli/commands/compile.rb', line 392

def listener_classes
  @listener_classes
end

Instance Method Details

#runObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
# File 'lib/nanoc/cli/commands/compile.rb', line 399

def run
  time_before = Time.now

  load_site

  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