class Maintainer::PIPInstall

Public Class Methods

new(pkg, msg_success, msg_error, should_crash) click to toggle source
# File lib/maintainer_core/instructions.rb, line 41
def initialize(pkg, msg_success, msg_error, should_crash)
    @package = pkg
    @msg_success = msg_success
    @msg_error = msg_error
    @should_crash = should_crash
end

Public Instance Methods

crash_on_error!() click to toggle source
# File lib/maintainer_core/instructions.rb, line 65
def crash_on_error!()
    return false
end
error_message!() click to toggle source
# File lib/maintainer_core/instructions.rb, line 76
def error_message!()
    if  not @msg_error or @msg_error.empty?
        return "[Error] #{@package}"
    end
    return "#{@msg_error}"
end
run!() click to toggle source
# File lib/maintainer_core/instructions.rb, line 48
def run!()
    # Check if pip is installed
    if not InstallPIP.installed!
        # Install PIP
        CommandRunner.execute(
            command: Commands::Pip::Install,
            error: nil
        )
    end
    # pip is installed
    CommandRunner.execute(
        command: "pip3 install #{@package}",
        error: nil
    )
    return true
end
success_message!() click to toggle source
# File lib/maintainer_core/instructions.rb, line 69
def success_message!()
    if not @msg_success or @msg_success.empty?
        return "[Installed] #{@package}"
    end
    return "#{@msg_success}"
end