in rake-runner-agent/src/jetbrains/buildServer/agent/ruby/rvm/detector/impl/RVMDetectorForUNIX.java [26:53]
public InstalledRVM detect(@NotNull final Map<String, String> env) {
// 1. Read "rvm_path" env variable
// 2. Try to find local rvm (rvm_path = $HOME/.rvm)
// 3. Try to find global rvm (rvm_path = /usr/local/.rvm)
// NOTE: Steps 2 and 3 via 'which rvm'
// custom or system wide rvm path
@Nullable final String specialPath = determinePathUsingEnvVariable(env);
@Nullable final String globalPath = determineGlobalRvmPath();
@Nullable final String localPath = determineLocalRvmPath();
if (specialPath != null) {
if (localPath != null && specialPath.equals(localPath)) {
return new InstalledRVM(localPath, InstalledRVM.Type.Local);
} else if (globalPath != null && specialPath.equals(globalPath)) {
return new InstalledRVM(globalPath, InstalledRVM.Type.Global);
} else {
return new InstalledRVM(specialPath, InstalledRVM.Type.Special);
}
} else if (localPath != null) {
return new InstalledRVM(localPath, InstalledRVM.Type.Local);
} else if (globalPath != null) {
return new InstalledRVM(globalPath, InstalledRVM.Type.Global);
} else {
// Nothing founded
return null;
}
}