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 313
def initialize(params={})
  @rep_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 320
def start
  Nanoc::NotificationCenter.on(:compilation_started) do |rep|
    @rep_times[rep.raw_path] = Time.now
  end
  Nanoc::NotificationCenter.on(:compilation_ended) do |rep|
    @rep_times[rep.raw_path] = Time.now - @rep_times[rep.raw_path]
  end
  Nanoc::NotificationCenter.on(:rep_written) do |rep, path, is_created, is_modified|
    action = (is_created ? :create : (is_modified ? :update : :identical))
    level  = (is_created ? :high   : (is_modified ? :high   : :low))
    duration = Time.now - @rep_times[rep.raw_path] if @rep_times[rep.raw_path]
    Nanoc::CLI::Logger.instance.file(level, action, path, duration)
  end
end
stop() click to toggle source

@see Listener#stop

# File lib/nanoc/cli/commands/compile.rb, line 336
def stop
  super
  @reps.select { |r| !r.compiled? }.each do |rep|
    rep.raw_paths.each do |snapshot_name, filename|
      next if filename.nil?
      duration = @rep_times[filename]
      Nanoc::CLI::Logger.instance.file(:high, :skip, filename, duration)
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.