public static void copyFiles(SecureChannel channel, List<Deployable> deployables, Properties filterProperties) {
if (CollectionUtils.isEmpty(deployables)) {
return;
}
for (Deployable deployable : deployables) {
RemoteFile destination = new RemoteFile.Builder(deployable.getRemote()).build();
String location = deployable.getLocal();
logger.info(" creating -> [{}]", destination.getAbsolutePath());
if (deployable.isFilter()) {
long start = System.currentTimeMillis();
String originalContent = LocationUtils.toString(location);
String resolvedContent = HELPER.replacePlaceholders(originalContent, filterProperties);
channel.copyStringToFile(resolvedContent, destination);
String elapsed = FormatUtils.getTime(System.currentTimeMillis() - start);
Object[] args = { filterProperties.size(), location, destination.getAbsolutePath(), elapsed };
logger.debug("Used {} properties to filter [{}] -> [{}] - {}", args);
} else {
long start = System.currentTimeMillis();
channel.copyLocationToFile(location, destination);
logCopy(location, destination.getAbsolutePath(), System.currentTimeMillis() - start);
}
if (deployable.getPermissions().isPresent()) {
String path = deployable.getRemote();
String perms = deployable.getPermissions().get();
String command = CMDS.chmod(perms, path);
executePathCommand(channel, command, path);
}
}
}