Sha256: 5770164c2e5f0a9e8346083addaeaeba88735874eab16c42b7e0fc622657caa0

Contents?: true

Size: 1.35 KB

Versions: 9

Compression:

Stored size: 1.35 KB

Contents

# frozen_string_literal: true

module Nanoc::CLI::Commands::CompileListeners
  class DebugPrinter < Abstract
    # @see Listener#enable_for?
    def self.enable_for?(command_runner)
      command_runner.debug?
    end

    # @see Listener#start
    def start
      Nanoc::Int::NotificationCenter.on(:compilation_started) do |rep|
        puts "*** Started compilation of #{rep.inspect}"
      end
      Nanoc::Int::NotificationCenter.on(:compilation_ended) do |rep|
        puts "*** Ended compilation of #{rep.inspect}"
        puts
      end
      Nanoc::Int::NotificationCenter.on(:compilation_suspended) do |rep, e|
        puts "*** Suspended compilation of #{rep.inspect}: #{e.message}"
      end
      Nanoc::Int::NotificationCenter.on(:cached_content_used) do |rep|
        puts "*** Used cached compiled content for #{rep.inspect} instead of recompiling"
      end
      Nanoc::Int::NotificationCenter.on(:filtering_started) do |rep, filter_name|
        puts "*** Started filtering #{rep.inspect} with #{filter_name}"
      end
      Nanoc::Int::NotificationCenter.on(:filtering_ended) do |rep, filter_name|
        puts "*** Ended filtering #{rep.inspect} with #{filter_name}"
      end
      Nanoc::Int::NotificationCenter.on(:dependency_created) do |src, dst|
        puts "*** Dependency created from #{src.inspect} onto #{dst.inspect}"
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
nanoc-4.8.3 lib/nanoc/cli/commands/compile_listeners/debug_printer.rb
nanoc-4.8.2 lib/nanoc/cli/commands/compile_listeners/debug_printer.rb
nanoc-4.8.1 lib/nanoc/cli/commands/compile_listeners/debug_printer.rb
nanoc-4.8.0 lib/nanoc/cli/commands/compile_listeners/debug_printer.rb
nanoc-4.7.14 lib/nanoc/cli/commands/compile_listeners/debug_printer.rb
nanoc-4.7.13 lib/nanoc/cli/commands/compile_listeners/debug_printer.rb
nanoc-4.7.12 lib/nanoc/cli/commands/compile_listeners/debug_printer.rb
nanoc-4.7.11 lib/nanoc/cli/commands/compile_listeners/debug_printer.rb
nanoc-4.7.10 lib/nanoc/cli/commands/compile_listeners/debug_printer.rb