module Confpkgs::Utils

This module contains methods that are not Linux distribution specific

Public Instance Methods

distro_name() click to toggle source

Returns lowercase name of linux distribution of current environment

# File lib/Utils.rb, line 15
def distro_name
  distro_name = %x(cat /etc/os-release | grep '^ID=')[3..-2]
end
is_linux() click to toggle source

Returns true if current environment is linux, false otherwise

# File lib/Utils.rb, line 8
def is_linux
  @os = RbConfig::CONFIG['host_os']
  return true if @os.downcase.match('linux')
  false
end
pretty_print(msg) click to toggle source

returns a prettier string

# File lib/Utils.rb, line 20
def pretty_print(msg)
  str = ""
  line = Proc.new {str += "+"; msg.size.times {str += "-"}; str+= "+\n"}
  line.call
  str += "|#{msg.capitalize}|\n"
  line.call
  str
end