Skip to content

Commit

Permalink
fix method rename and new client version
Browse files Browse the repository at this point in the history
  • Loading branch information
katerina20 committed Jan 17, 2024
1 parent 3b61f20 commit c278108
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void act(Outputter out, ProjectProperties properties, ProjectClient clien
out.println(SKIPPED.withIcon(RESOURCE_BUNDLE.getString("message.no_file_string_project")));
return;
}
String filePath = Utils.unixPath(Utils.sepAtStart(file));
String filePath = Utils.toUnixPath(Utils.sepAtStart(file));
List<FileInfo> projectFiles = project.getFileInfos();
FileInfo foundFile = projectFiles.stream()
.filter(f -> Objects.equals(filePath, f.getPath()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,16 @@ public void act(Outputter out, ProjectProperties properties, ProjectClient clien
return;
}

String filePath = Utils.unixPath(Utils.sepAtStart(file));
String filePath = Utils.toUnixPath(Utils.sepAtStart(file));
FileInfo foundFile = project.getFileInfos().stream()
.filter(f -> Objects.equals(filePath, f.getPath()))
.findFirst()
.orElseThrow(() -> new RuntimeException(String.format(RESOURCE_BUNDLE.getString("error.file_not_found"), filePath)));
System.out.println("Check log " + foundFile.getId());
URL url = client.downloadFile(foundFile.getId());
String destPath = nonNull(dest) ? Utils.normalizePath(Utils.sepAtEnd(dest)) + foundFile.getName() : filePath;
saveToFile(destPath, url);
String destPath = nonNull(dest) ? Utils.sepAtEnd(dest) + foundFile.getName() : file;
System.out.println("Check destPath" + destPath);
saveToFile(Utils.normalizePath(destPath), url);
out.println(OK.withIcon(String.format(RESOURCE_BUNDLE.getString("message.downloaded_file"), filePath)));
out.println(WARNING.withIcon(RESOURCE_BUNDLE.getString("message.experimental_command")));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void act(Outputter out, ProjectProperties properties, ProjectClient clien

Language language = project.findLanguageById(languageId, true)
.orElseThrow(() -> new RuntimeException(String.format(RESOURCE_BUNDLE.getString("error.language_not_exist"), languageId)));
String sourcePath = Utils.unixPath(Utils.sepAtStart(file));
String sourcePath = Utils.toUnixPath(Utils.sepAtStart(file));
FileInfo sourceFileInfo = project.getFileInfos().stream()
.filter(fi -> Objects.equals(sourcePath, fi.getPath()))
.findFirst()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void act(Outputter out, ProjectProperties properties, ProjectClient clien
if (Objects.equals(Type.FILES_BASED, project.getType())) {
if (Objects.isNull(dest))
throw new RuntimeException(String.format(RESOURCE_BUNDLE.getString("error.file.dest_required"), languageId));
String sourcePath = Utils.unixPath(Utils.sepAtStart(dest));
String sourcePath = Utils.toUnixPath(Utils.sepAtStart(dest));
FileInfo sourceFileInfo = project.getFileInfos().stream()
.filter(fi -> Objects.equals(sourcePath, fi.getPath()))
.findFirst()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void testUploadTranslation_FileBasedProject() throws ResponseException {
when(client.uploadStorage(eq("first_uk.po"), any()))
.thenReturn(1L);

NewAction<ProjectProperties, ProjectClient> action = new FileUploadTranslationAction(fileToUpload, null, "first.po", "ua", false);
NewAction<ProjectProperties, ProjectClient> action = new FileUploadTranslationAction(fileToUpload, null, "/first.po", "ua", false);
action.act(Outputter.getDefault(), pb, client);

verify(client).downloadFullProject(any());
Expand Down
2 changes: 1 addition & 1 deletion versions.properties
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ version.commons-cli..commons-cli=1.5.0

version.com.h3xstream.findsecbugs..findsecbugs-plugin=1.12.0

version.com.github.crowdin..crowdin-api-client-java=1.13.0
version.com.github.crowdin..crowdin-api-client-java=1.14.0

plugin.org.asciidoctor.jvm.convert=3.3.2

Expand Down

0 comments on commit c278108

Please sign in to comment.