static public void setInterpreterPath()

in rake-runner-test/src/jetbrains/slow/plugins/rakerunner/RakeRunnerTestUtil.java [87:109]


  static public void setInterpreterPath(@NotNull final BuildTypeEx bt) throws InterpreterNotFoundException {
    String interpreterPath = System.getProperty(INTERPRETER_PATH_PROPERTY);
    if (StringUtil.isEmpty(interpreterPath)) {
      for (String prefix : RubyVersionsDataProvider.getRubyVersionsWindowsSet()) {
        try {
          final File file = getWindowsInterpreterExecutableFile(prefix);
          interpreterPath = file.getAbsolutePath();
        } catch (InterpreterNotFoundException ignore) {
        }
      }
    }
    if (StringUtil.isEmpty(interpreterPath)) {
      interpreterPath = OSUtil.findRubyInterpreterInPATH(System.getenv());
    }
    if (StringUtil.isEmpty(interpreterPath)) {
      throw new InterpreterNotFoundException("Cannot find interpreter in PATH, by property '" + INTERPRETER_PATH_PROPERTY +
        "' and in storage '" + INTERPRETERS_STORAGE_PATH_PROPERTY + "'");
    } else {
      bt.addRunParameter(new SimpleParameter(RakeRunnerConstants.SERVER_UI_RUBY_INTERPRETER_PATH, interpreterPath));
      bt.addRunParameter(new SimpleParameter(RakeRunnerConstants.SERVER_UI_RUBY_USAGE_MODE,
        RakeRunnerUtils.RubyConfigMode.INTERPRETER_PATH.getModeValueString()));
    }
  }