Sha256: aa808f1d7ebf013b6d21b28b5d41bff10962691729174d0a6b1adb708e89eb79
Contents?: true
Size: 1.01 KB
Versions: 5
Compression:
Stored size: 1.01 KB
Contents
require 'open3' module Learn module PythonUnittest class RequirementsChecker def self.check_installation new.check_installation end def check_installation PythonChecker.check PipChecker.check end end class PythonChecker def self.check new.check end def check if !python_installed? || !correct_python_version? puts "Please install python 2.7.x or 3.x.x" exit end end def python_installed? !`which python`.empty? end def correct_python_version? output = Open3.popen3('python', '--version') version = output[2].read.strip !!version.match(/ 2.7.*| 3.*/) end end class PipChecker def self.check new.check end def check if !pip_installed? puts "Please ensure pip is installed" exit end end def pip_installed? !`which pip`.empty? end end end end
Version data entries
5 entries across 5 versions & 1 rubygems