Module: ObserverPathnameExtension

Defined in:
Library/Homebrew/extend/pathname.rb

Constant Summary collapse

MAXIMUM_VERBOSE_OUTPUT =
100

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.dObject

Returns the value of attribute d



487
488
489
# File 'Library/Homebrew/extend/pathname.rb', line 487

def d
  @d
end

.nObject

Returns the value of attribute n



487
488
489
# File 'Library/Homebrew/extend/pathname.rb', line 487

def n
  @n
end

Class Method Details

.countsObject



498
499
500
# File 'Library/Homebrew/extend/pathname.rb', line 498

def counts
  [n, d]
end

.reset_counts!Object



489
490
491
492
# File 'Library/Homebrew/extend/pathname.rb', line 489

def reset_counts!
  @n = @d = 0
  @put_verbose_trimmed_warning = false
end

.totalObject



494
495
496
# File 'Library/Homebrew/extend/pathname.rb', line 494

def total
  n + d
end

.verbose?Boolean

Returns:

  • (Boolean)


504
505
506
507
508
509
510
511
512
513
514
515
516
517
# File 'Library/Homebrew/extend/pathname.rb', line 504

def verbose?
  return ARGV.verbose? unless ENV["CI"]
  return false unless ARGV.verbose?

  if total < MAXIMUM_VERBOSE_OUTPUT
    true
  else
    unless @put_verbose_trimmed_warning
      puts "Only the first #{MAXIMUM_VERBOSE_OUTPUT} operations were output."
      @put_verbose_trimmed_warning = true
    end
    false
  end
end

Instance Method Details

#install_infoObject



543
544
545
546
# File 'Library/Homebrew/extend/pathname.rb', line 543

def install_info
  super
  puts "info #{self}" if ObserverPathnameExtension.verbose?
end


537
538
539
540
541
# File 'Library/Homebrew/extend/pathname.rb', line 537

def make_relative_symlink(src)
  super
  puts "ln -s #{src.relative_path_from(dirname)} #{basename}" if ObserverPathnameExtension.verbose?
  ObserverPathnameExtension.n += 1
end

#mkpathObject



526
527
528
529
# File 'Library/Homebrew/extend/pathname.rb', line 526

def mkpath
  super
  puts "mkdir -p #{self}" if ObserverPathnameExtension.verbose?
end

#rmdirObject



531
532
533
534
535
# File 'Library/Homebrew/extend/pathname.rb', line 531

def rmdir
  super
  puts "rmdir #{self}" if ObserverPathnameExtension.verbose?
  ObserverPathnameExtension.d += 1
end

#uninstall_infoObject



548
549
550
551
# File 'Library/Homebrew/extend/pathname.rb', line 548

def uninstall_info
  super
  puts "uninfo #{self}" if ObserverPathnameExtension.verbose?
end


520
521
522
523
524
# File 'Library/Homebrew/extend/pathname.rb', line 520

def unlink
  super
  puts "rm #{self}" if ObserverPathnameExtension.verbose?
  ObserverPathnameExtension.n += 1
end