module GitCli::OS::Linux::Utils

Public Class Methods

is_installed?(binary) click to toggle source
# File lib/git_cli/os/linux/utils.rb, line 27
def Utils.is_installed?(binary)

  if is_which_installed? 
    
    begin
      GitCli::Global.instance.logger.debug "Checking if '#{binary}' is installed..."
      res = Antrapol::ToolRack::ProcessUtilsEngine.exec("which #{binary}")
      GitCli::Global.instance.logger.debug "Yes, '#{binary}' is found in system"
      [true, res.strip]
    rescue Exception => ex 
      GitCli::Global.instance.logger.debug "No, '#{binary}' is not found in system"
      [false, ex.message]
    end

  else
    raise GitCliException, "Utility 'which' is not installed"
  end
end

Private Class Methods

is_which_installed?() click to toggle source
# File lib/git_cli/os/linux/utils.rb, line 47
def Utils.is_which_installed?
  begin
    GitCli::Global.instance.logger.debug "Checking if 'which' is installed..."
    Antrapol::ToolRack::ProcessUtilsEngine.exec("which")
    GitCli::Global.instance.logger.debug "'which' utility is installed..."
    true
  rescue Exception => ex
    GitCli::Global.instance.logger.debug "'which' utility is NOT installed..."
    false
  end
end