Class: Drupid::Updater::Log

Inherits:
Object
  • Object
show all
Includes:
Drupid::Utils
Defined in:
lib/drupid/updater.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Drupid::Utils

#blah, #bzr, #compare_paths, #curl, #cvs, #debug, #dont_debug, #git, #hg, #ignore_interrupts, #interactive_shell, #odie, #ofail, #ohai, #owarn, #runBabyRun, #svn, #tempdir, #uncompress, #which, #writeFile

Constructor Details

#initializeLog

Creates a new log object.



491
492
493
494
495
496
# File 'lib/drupid/updater.rb', line 491

def initialize
  @actions = Array.new
  @errors = Array.new
  @warnings = Array.new
  @notices = Array.new
end

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



485
486
487
# File 'lib/drupid/updater.rb', line 485

def actions
  @actions
end

#errorsObject (readonly)

Returns the value of attribute errors.



486
487
488
# File 'lib/drupid/updater.rb', line 486

def errors
  @errors
end

#noticesObject (readonly)

Returns the value of attribute notices.



488
489
490
# File 'lib/drupid/updater.rb', line 488

def notices
  @notices
end

#warningsObject (readonly)

Returns the value of attribute warnings.



487
488
489
# File 'lib/drupid/updater.rb', line 487

def warnings
  @warnings
end

Instance Method Details

#action(a) ⇒ Object

Adds an action to the log.



499
500
501
502
# File 'lib/drupid/updater.rb', line 499

def action(a)
  @actions << a
  puts a.msg
end

#actions?Boolean

Returns:

  • (Boolean)


504
505
506
# File 'lib/drupid/updater.rb', line 504

def actions?
  @actions.size > 0
end

#apply_pending_actionsObject



512
513
514
515
516
517
# File 'lib/drupid/updater.rb', line 512

def apply_pending_actions
  @actions.find_all { |a| a.pending? }.each do |pa|
    pa.fire!
    puts pa.msg
  end
end

#clearObject

Clears the whole log.



552
553
554
555
556
# File 'lib/drupid/updater.rb', line 552

def clear
  @errors.clear
  @warnings.clear
  @notices.clear
end

#error(msg) ⇒ Object

Adds an error message to the log.



520
521
522
523
# File 'lib/drupid/updater.rb', line 520

def error(msg)
  @errors << msg
  ofail @errors.last
end

#errors?Boolean

Returns true if this log contains error messages; returns false otherwise.

Returns:

  • (Boolean)


527
528
529
# File 'lib/drupid/updater.rb', line 527

def errors?
  @errors.size > 0
end

#merge(other) ⇒ Object

Appends the content of another log to this one.



559
560
561
562
563
564
# File 'lib/drupid/updater.rb', line 559

def merge(other)
  @actions += other.actions
  @errors += other.errors
  @warnings += other.warnings
  @notices += other.notices
end

#notice(msg) ⇒ Object

Adds a notice to the log.



542
543
544
545
# File 'lib/drupid/updater.rb', line 542

def notice(msg)
  @notices << msg
  blah @notices.last
end

#notices?Boolean

Returns:

  • (Boolean)


547
548
549
# File 'lib/drupid/updater.rb', line 547

def notices?
  @notices.size > 0
end

#pending_actions?Boolean

Returns:

  • (Boolean)


508
509
510
# File 'lib/drupid/updater.rb', line 508

def pending_actions?
  @actions.find_all { |a| a.pending? }.size > 0
end

#warning(msg) ⇒ Object

Adds a warning to the log.



532
533
534
535
# File 'lib/drupid/updater.rb', line 532

def warning(msg)
  @warnings << msg
  owarn @warnings.last
end

#warnings?Boolean

Returns:

  • (Boolean)


537
538
539
# File 'lib/drupid/updater.rb', line 537

def warnings?
  @warnings.size > 0
end