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, TimingRecorder

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, arguments, command) ⇒ Compile

Returns a new instance of Compile



355
356
357
358
# File 'lib/nanoc/cli/commands/compile.rb', line 355

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

Instance Attribute Details

#listener_classesObject

Returns the value of attribute listener_classes



353
354
355
# File 'lib/nanoc/cli/commands/compile.rb', line 353

def listener_classes
  @listener_classes
end

Instance Method Details

#runObject



360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# File 'lib/nanoc/cli/commands/compile.rb', line 360

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