Module: Storazzo::Common

Includes:
Colors
Included in:
Media::AbstractRicDisk, Media::LocalFolder, RicDisk, RicDisk, RicDisk::GcsBucket, RicDiskConfig
Defined in:
lib/storazzo/common.rb

Constant Summary

Constants included from Colors

Storazzo::Colors::PREPEND_ME

Instance Method Summary collapse

Methods included from Colors

#azure, #blue, #deb2, #gray, #green, #orange, #pgreen, #pred, #purple, #pwhite, #pyellow, #red, #white, #yellow

Instance Method Details

#bug(s) ⇒ Object



57
58
59
# File 'lib/storazzo/common.rb', line 57

def bug(s)
  puts "[πŸ›] #{gray s}"
end

#deb(s) ⇒ Object



36
37
38
# File 'lib/storazzo/common.rb', line 36

def deb(s)
  puts "[DEBπŸ‘€] #{yellow(s)}" if _debug_true # $DEBUG
end

#err(str) ⇒ Object



53
54
55
# File 'lib/storazzo/common.rb', line 53

def err(str)
  puts "[ERRπŸ‘Ž] #{red(s)}" # β›”
end

#fatal(s) ⇒ Object



71
72
73
# File 'lib/storazzo/common.rb', line 71

def fatal(s)
  raise "[FπŸ’€TAL] #{red s}"
end

#if_deb?Boolean

this has a yield

Returns:

  • (Boolean)


41
42
43
44
45
46
47
# File 'lib/storazzo/common.rb', line 41

def if_deb?()
  if _debug_true # $DEBUG
    deb "== yield START =="
    yield
    deb "== yield END =="
  end
end

#linux?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/storazzo/common.rb', line 79

def linux?
  `uname`.chomp == 'Linux'
end

#mac?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/storazzo/common.rb', line 75

def mac?
  `uname`.chomp == 'Darwin'
end

#ppp(complex_object_to_colorize) ⇒ Object



66
67
68
69
# File 'lib/storazzo/common.rb', line 66

def ppp(complex_object_to_colorize)
  # TODO i need to learn to return without printing..
  Pry::ColorPrinter.pp(complex_object_to_colorize)
end

#pverbose(is_verbose, str) ⇒ Object



61
62
63
64
# File 'lib/storazzo/common.rb', line 61

def pverbose(is_verbose, str)
  # puts "[VπŸ“šRBπŸ’€SπŸ“š] #{gray str}"
  puts "[πŸ¦‹πŸ›πŸπŸžπŸœπŸ•·πŸ•ΈπŸ¦‚πŸ¦—πŸ¦Ÿ] #{gray str}" # insects: http://xahlee.info/comp/unicode_insects.html
end

#warn(s) ⇒ Object



49
50
51
# File 'lib/storazzo/common.rb', line 49

def warn(s)
  puts "[W⚠️RN] #{azure(s)}"
end