Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Commit

Permalink
Fix no CLI-only app.zip version
Browse files Browse the repository at this point in the history
  • Loading branch information
binwiederhier committed Mar 22, 2015
1 parent 7c47525 commit ba4c086
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions syncany-cli/src/main/java/org/syncany/cli/UpdateCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ private void printResultCheck(UpdateOperationResult operationResult) {
String remoteAppVersion = remoteAppInfo.getAppVersion();

if (operationResult.isNewVersionAvailable()) {
out.println("A new version is available. Local version is " + localAppVersion + ", remote version is " + remoteAppVersion + ".");
out.println("A new version is available. Local version is " + localAppVersion + ", remote version is " + remoteAppVersion);
out.println("Download at " + remoteAppInfo.getDownloadUrl());
}
else {
out.println("Up to date. At version " + localAppVersion + ".");
out.println("Up to date, at version " + localAppVersion);
}
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ private UpdateOperationResult executeCheck() throws Exception {
}

private String getAppInfoResponseStr() throws Exception {
String typeStr = determineType();
String distStr = determineDist(typeStr);
boolean hasGuiPlugin = Plugins.get("gui") != null;

String typeStr = determineType(hasGuiPlugin);
String distStr = determineDist(hasGuiPlugin, typeStr);
String snapshotsEnabled = (options.isSnapshots()) ? "true" : "false";
String osStr = EnvironmentUtil.getOperatingSystemDescription();
String archStr = EnvironmentUtil.getArchDescription();
Expand Down Expand Up @@ -131,26 +133,22 @@ private String getAppInfoResponseStr() throws Exception {
return responseStr;
}

private String determineType() {
private String determineType(boolean hasGuiPlugin) {
if (EnvironmentUtil.isWindows()) {
return "exe";
}
else if (EnvironmentUtil.isMacOSX()) {
return "app.zip";
return (hasGuiPlugin) ? "app.zip" : "zip";
}
else if (EnvironmentUtil.isUnixLikeOperatingSystem()) {
if (EnvironmentUtil.isDebianBased()) {
return "deb";
}
return (EnvironmentUtil.isDebianBased()) ? "deb" : "tar.gz";
}

return "zip";
}

private String determineDist(String type) {
boolean hasGuiPlugin = Plugins.get("gui") != null;
boolean packageWithGuiExists = type.equals("exe") || type.equals("app.zip");

private String determineDist(boolean hasGuiPlugin, String type) {
boolean packageWithGuiExists = type.equals("exe") || type.equals("app.zip");
return (hasGuiPlugin && packageWithGuiExists) ? "gui" : "cli";
}
}

0 comments on commit ba4c086

Please sign in to comment.