Method: Gauntlt::Support::PythonScriptHelper#ensure_python_script_installed

Defined in:
lib/gauntlt/attack_adapters/support/python_script_helper.rb

#ensure_python_script_installed(script_name, debug = false) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/gauntlt/attack_adapters/support/python_script_helper.rb', line 34

def ensure_python_script_installed(script_name, debug=false)
  python_script_installed?(script_name) || begin
    shell_variable_name = '$' + shell_variable_name_for(script_name)

    msg = "    \#{script_name}.py not installed or \#{shell_variable_name} not set!\n\n    1. Download \#{script_name} from: \#{DOWNLOAD_URLS[script_name]}\n    2. In your .zshrc or .bash_profile (or whatever), set \#{shell_variable_name}\n\n export \#{shell_variable_name.gsub('$', '')}=/path/to/\#{script_name}.py\n\n    3. Make sure you have python installed:\n\n $ which python\n\n\n"

    if debug
      msg += "      python installed : \#{python_installed?}\n      script_exists? : \#{script_exists?(script_name)}\n      shell_variable_name: \#{shell_variable_name_for(script_name)}\n      path:   \#{path_to_python_script(script_name)}\n      path_via_echo: \#{`echo \#{'$'+shell_variable_name_for(script_name)}`}\n"
    end

    raise msg

  end
end