Methods

Class/Module Index [+]

Quicksearch

Nanoc::CLI::Commands::Compile::FileActionPrinter

Prints file actions (created, updated, deleted, identical, skipped)

Public Class Methods

new(params = {}) click to toggle source

@option params [Array<Nanoc::ItemRep>] :reps The list of item representations in the site

# File lib/nanoc/cli/commands/compile.rb, line 332
def initialize(params = {})
  @start_times = {}

  @reps = params.fetch(:reps)
end

Public Instance Methods

start() click to toggle source

@see Listener#start

# File lib/nanoc/cli/commands/compile.rb, line 339
def start
  Nanoc::NotificationCenter.on(:compilation_started) do |rep|
    @start_times[rep.raw_path] = Time.now
  end
  Nanoc::NotificationCenter.on(:rep_written) do |rep, path, is_created, is_modified|
    duration = path && @start_times[path] ? Time.now - @start_times[path] : nil
    action =
      case
      when is_created  then :create
      when is_modified then :update
      else :identical
      end
    level =
      case
      when is_created  then :high
      when is_modified then :high
      else :low
      end
    log(level, action, path, duration)
  end
end
stop() click to toggle source

@see Listener#stop

# File lib/nanoc/cli/commands/compile.rb, line 362
def stop
  super
  @reps.select { |r| !r.compiled? }.each do |rep|
    rep.raw_paths.each do |snapshot_name, raw_path|
      log(:low, :skip, raw_path, nil)
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.