in rake-runner-agent/src/jetbrains/buildServer/agent/rakerunner/utils/BundlerUtil.java [173:209]
private static String getBundlerGemsDirFromConfig(@NotNull final RubySdk sdk,
@NotNull final String gemfilePath) throws RunBuildException {
final String gemfileParentFolder = new File(gemfilePath).getParent();
final String configPath = gemfileParentFolder + File.separator + ".bundle" + File.separator + "config";
// file separators aren't important here
if (!checkIfExists(configPath)) {
return null;
}
final String text;
try {
text = new String(FileUtil.loadFileText(new File(configPath)));
} catch (IOException e) {
throw new RunBuildException(e);
}
final Matcher matcher = BUNDLE_PATH_PATTERN.matcher(text);
if (matcher.find()) {
final String dir = matcher.group(1);
// if relative path:
String bundlePath = gemfileParentFolder + File.separator + dir;
if (!checkIfDirExists(bundlePath)) {
// else if local path
if (dir.startsWith("~")) {
bundlePath = OSUtil.getUserHomeFolder() + dir.substring(1);
}
if (!checkIfDirExists(bundlePath)) {
// else if full path
bundlePath = dir;
}
}
if (checkIfDirExists(bundlePath)) {
return findGemFolderForSdk(sdk, bundlePath);
}
}
return null;
}