Class: Nanoc::CLI::Commands::Compile::FileActionPrinter Private
- Defined in:
- lib/nanoc/cli/commands/compile.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Prints file actions (created, updated, deleted, identical, skipped)
Instance Method Summary collapse
-
#initialize(reps:) ⇒ FileActionPrinter
constructor
private
A new instance of FileActionPrinter.
- #start ⇒ Object private
- #stop ⇒ Object private
Methods inherited from Listener
enable_for?, #start_safely, #stop_safely
Constructor Details
#initialize(reps:) ⇒ FileActionPrinter
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of FileActionPrinter.
326 327 328 329 330 |
# File 'lib/nanoc/cli/commands/compile.rb', line 326 def initialize(reps:) @start_times = {} @reps = reps end |
Instance Method Details
#start ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 |
# File 'lib/nanoc/cli/commands/compile.rb', line 333 def start Nanoc::Int::NotificationCenter.on(:compilation_started) do |rep| @start_times[rep.raw_path] = Time.now end Nanoc::Int::NotificationCenter.on(:rep_written) do |_rep, path, is_created, is_modified| duration = path && @start_times[path] ? Time.now - @start_times[path] : nil action = if is_created then :create elsif is_modified then :update else :identical end level = if is_created then :high elsif is_modified then :high else :low end log(level, action, path, duration) end end |
#stop ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
354 355 356 357 358 359 360 361 |
# File 'lib/nanoc/cli/commands/compile.rb', line 354 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 |