Method: App::UtilsTools.check_sshpass_is_installed

Defined in:
lib/core/utils_tools.rb

.check_sshpass_is_installedObject

Check that SSHPASS is installed.

Returns:

  • void



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/core/utils_tools.rb', line 39

def self.check_sshpass_is_installed
    if @sshpass_installed.nil?
        sshpass_result = App::Terminal::command_capture('sshpass -h', nil, false, false)
        sshpass_result = sshpass_result[0].split(' ')
        unless sshpass_result[0].downcase == 'usage:'
            if this_is_a_mac
                error_message = "Find how to install it at: #{App::Terminal::format_highlight('https://www.google.co.uk/search?q=install+sshpass+on+mac')}"
            else
                error_message = "Install it using: #{App::Terminal::format_command('sudo apt-get install sshpass')}"
            end
            App::Terminal::error("#{App::Terminal::format_highlight('sshpass')} is not installed", error_message, true)
        end
        @sshpass_installed = true
    end
end