use of com.google.gerrit.extensions.config.CloneCommand in project gerrit by GerritCodeReview.
the class GetServerInfo method getDownloadSchemeInfo.
private DownloadSchemeInfo getDownloadSchemeInfo(DownloadScheme scheme, DynamicMap<DownloadCommand> downloadCommands, DynamicMap<CloneCommand> cloneCommands) {
DownloadSchemeInfo info = new DownloadSchemeInfo();
info.url = scheme.getUrl("${project}");
info.isAuthRequired = toBoolean(scheme.isAuthRequired());
info.isAuthSupported = toBoolean(scheme.isAuthSupported());
info.commands = new HashMap<>();
for (DynamicMap.Entry<DownloadCommand> e : downloadCommands) {
String commandName = e.getExportName();
DownloadCommand command = e.getProvider().get();
String c = command.getCommand(scheme, "${project}", "${ref}");
if (c != null) {
info.commands.put(commandName, c);
}
}
info.cloneCommands = new HashMap<>();
for (DynamicMap.Entry<CloneCommand> e : cloneCommands) {
String commandName = e.getExportName();
CloneCommand command = e.getProvider().get();
String c = command.getCommand(scheme, "${project-path}/${project-base-name}");
if (c != null) {
c = c.replaceAll("\\$\\{project-path\\}/\\$\\{project-base-name\\}", "\\$\\{project\\}");
info.cloneCommands.put(commandName, c);
}
}
return info;
}
use of com.google.gerrit.extensions.config.CloneCommand in project gerrit by GerritCodeReview.
the class GetServerInfo method getDownloadSchemeInfo.
private DownloadSchemeInfo getDownloadSchemeInfo(DownloadScheme scheme) {
DownloadSchemeInfo info = new DownloadSchemeInfo();
info.url = scheme.getUrl("${project}");
info.isAuthRequired = toBoolean(scheme.isAuthRequired());
info.isAuthSupported = toBoolean(scheme.isAuthSupported());
info.commands = new HashMap<>();
downloadCommands.runEach(extension -> {
String commandName = extension.getExportName();
DownloadCommand command = extension.get();
String c = command.getCommand(scheme, "${project}", "${ref}");
if (c != null) {
info.commands.put(commandName, c);
}
});
info.cloneCommands = new HashMap<>();
cloneCommands.runEach(extension -> {
String commandName = extension.getExportName();
CloneCommand command = extension.getProvider().get();
String c = command.getCommand(scheme, "${project-path}/${project-base-name}");
if (c != null) {
c = c.replaceAll("\\$\\{project-path\\}/\\$\\{project-base-name\\}", "\\$\\{project\\}");
info.cloneCommands.put(commandName, c);
}
});
return info;
}
Aggregations