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

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

Defined Under Namespace

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, arguments, command) ⇒ Compile

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

Returns the value of attribute listener_classes



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

def listener_classes
  @listener_classes
end

Instance Method Details

#runObject



399
400
401
402
403
404
405
406
407
408
409
410
411
412
# 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
  end

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