Skip to content
This repository has been archived by the owner on Sep 22, 2021. It is now read-only.

WIP: v0.1.3 #55

Merged
merged 5 commits into from
Mar 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.1.2
current_version = 0.1.3
commit = True
tag = False

Expand Down
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ deploy:
secure: bu664xqdPaj+6JomOZJ7ivzIaDrGZXySCApcAYO7AIwBY0KlkbFO/zY/kYb7XRu7DfNYqDM9i2gGsdqneTDlvjg8NmxkpviKjrPMG8Fp8sjQK544ae4kpptMFc9d0eC+z5lv1WjrK9Jzq7Mnv0SKAcdtGguoGkUN1xE3PqK3wmvz7xKSAWSZZM3e5lw9AbBgShQTBfAV3qkE06Ga34Al72mqJ7BS3ZscxnJiLMW+jhlAGE+t+GybE53+QLgMJje2RU6gRJagi+IIem93uQuGAdZ6+eYrd4yqxEQyZpBIQz9kJs6P+WqC4yk46cmEBUZEYA/U8vxPOd7e8UawtOSfBMODvJKLAZoB/GKWXm9u0i0C906DEBZPSMMTVe3Pq1pO4smqiv8aC5cTCxsM3MXqsl1yssnhFX/HDJgu+QAqEoXmXNLUF4OV/1tIdveJXXjvGHOGUhTbC65d0qHA7alSUhql/IQ9Ha7QtSMFKVf3Re8U2IWr9VYfOhgGDw9e3cdARkDwZo+xk7moIfr4XGUMpOWRowZ+i0jZK2rE720T6TvsTjW95G9lXiUkViVex+vbiv/CwXak/msG5P/mkPxu8DACRltdquqAyyVZTZL94HOaL8Ra4g8GjyNOWmQujv4GgPltd0ZjCoEZh6IQ/qiyozRtonLgEwRMNzs7+wz5JOE=
skip_cleanup: true
file:
- build/distributions/goobox-sync-sia-0.1.2-linux.tar.gz
- build/distributions/goobox-sync-sia-0.1.2-mac.tar.gz
- build/distributions/goobox-sync-sia-0.1.2-win64.tar.gz
- build/distributions/goobox-sync-sia-0.1.3-linux.tar.gz
- build/distributions/goobox-sync-sia-0.1.3-mac.tar.gz
- build/distributions/goobox-sync-sia-0.1.3-win64.tar.gz
on:
tags: true
repo: GooBox/goobox-sync-sia
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# goobox-sync-sia
[![Build Status](https://travis-ci.org/GooBox/goobox-sync-sia.svg?branch=master)](https://travis-ci.org/GooBox/goobox-sync-sia)
[![Build status](https://ci.appveyor.com/api/projects/status/j4lv9lnd07o1qe5n/branch/master?svg=true)](https://ci.appveyor.com/project/jkawamoto/goobox-sync-sia/branch/master)
[![Release](https://img.shields.io/badge/release-0.1.2-brightgreen.svg)](https://github.com/GooBox/goobox-sync-sia/releases/tag/v0.1.2)
[![Release](https://img.shields.io/badge/release-0.1.3-brightgreen.svg)](https://github.com/GooBox/goobox-sync-sia/releases/tag/v0.1.3)
[![GPLv3](https://img.shields.io/badge/license-GPLv3-blue.svg)](https://www.gnu.org/copyleft/gpl.html)

sync app for [sia](https://sia.tech/).
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ apply plugin: "com.github.hierynomus.license"
apply plugin: "com.github.kt3k.coveralls"


version = '0.1.2'
version = '0.1.3'
mainClassName = 'io.goobox.sync.sia.App'
applicationDefaultJvmArgs = ["-Dlogback.statusListenerClass=ch.qos.logback.core.status.NopStatusListener"]

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
</dependency>
</dependencies>
<properties>
<project-version>0.1.2</project-version>
<project-version>0.1.3</project-version>
<java.version>1.7</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/io/goobox/sync/sia/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public final class App implements Callable<Integer> {
/**
* Version information.
*/
public static final String Version = "0.1.2";
public static final String Version = "0.1.3";

/**
* The number of the minimum required contracts.
Expand Down Expand Up @@ -285,6 +285,7 @@ public Context getContext() {
}

public void refreshOverlayIcon(@NotNull Path localPath) {
logger.trace("Refresh the overlay icon of {}", localPath);
this.overlayHelper.refresh(localPath);
if (DB.isSynced()) {
this.overlayHelper.setOK();
Expand Down Expand Up @@ -395,6 +396,7 @@ public Integer call() throws IOException {
}

this.resumeTasks(ctx, executor);
this.refreshOverlayIcon(ctx.getConfig().getSyncDir());

final RecoveryTask startSiaDaemonTask = new StartSiaDaemonTask();
executor.scheduleWithFixedDelay(
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/io/goobox/sync/sia/task/CheckStateTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,7 @@ private void enqueueForUpload(@NotNull final Path localPath) throws IOException
private void enqueueForDownload(@NotNull final SiaFile file) throws IOException {

DB.addForDownload(file, file.getLocalPath());
if (Files.exists(file.getLocalPath())) {
App.getInstance().ifPresent(app -> app.refreshOverlayIcon(file.getLocalPath()));
}
App.getInstance().ifPresent(app -> app.refreshOverlayIcon(file.getLocalPath()));
this.executor.execute(new RetryableTask(new DownloadCloudFileTask(this.ctx, file.getName()), new StartSiaDaemonTask()));

}
Expand Down Expand Up @@ -374,6 +372,7 @@ private void processLocalFile(Set<String> processedFiles) {
// It should be deleted from the DB.
logger.debug("Remove deleted file {} from the sync DB", syncFile.getName());
DB.remove(syncFile.getName());
App.getInstance().ifPresent(app -> syncFile.getLocalPath().ifPresent(app::refreshOverlayIcon));
return syncFile.getName();
})
.forEach(processedFiles::add);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ public Void call() throws ApiException {
if (syncFileOpt.isPresent()) {

final SyncFile syncFile = syncFileOpt.get();
if (syncFile.getState() != SyncState.UPLOADING) {
if (syncFile.getState() == SyncState.SYNCED) {
logger.trace("Skip processing {} because it has been already synced", syncFile.getName());
return;
} else if (syncFile.getState() != SyncState.UPLOADING) {
logger.debug("Cancel uploading {} because it's not marked as UPLOADING: {}", syncFile.getName(), syncFile.getState());
try {
api.renterDeleteSiapathPost(APIUtils.toSlash(siaFile.getCloudPath()));
Expand Down
3 changes: 3 additions & 0 deletions src/test/java/io/goobox/sync/sia/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ public void testCall() throws GetWalletInfoTask.WalletException, ApiException, I
new FileWatcher(ctx.getConfig().getSyncDir(), executor);

overlayHelper.setSynchronizing();
app.refreshOverlayIcon(ctx.getConfig().getSyncDir());
}};

new Expectations(System.class) {{
Expand Down Expand Up @@ -497,6 +498,7 @@ public void testCallWithOutputEvents() throws IOException, GetWalletInfoTask.Wal
new FileWatcher(ctx.getConfig().getSyncDir(), executor);

overlayHelper.setSynchronizing();
app.refreshOverlayIcon(ctx.getConfig().getSyncDir());
}};

new Expectations(System.class) {{
Expand Down Expand Up @@ -585,6 +587,7 @@ public void testCallWithOutputEventsAndDisableAutoAllocation() throws IOExceptio
new FileWatcher(ctx.getConfig().getSyncDir(), executor);

overlayHelper.setSynchronizing();
app.refreshOverlayIcon(ctx.getConfig().getSyncDir());
}};

app.call();
Expand Down
7 changes: 4 additions & 3 deletions src/test/java/io/goobox/sync/sia/task/CheckStateTaskTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ public void newCloudFile() throws ApiException {
api.renterFilesGet();
result = res;

// Since the local files doesn't exist yet, refresh should be skipped.
App.getInstance();
times = 0;
result = Optional.of(app);
app.refreshOverlayIcon(siaFile.getLocalPath());
}};

final ExecutorMock executor = new ExecutorMock();
Expand Down Expand Up @@ -752,7 +752,8 @@ public void downloadFailedAndLocalFileIsNotFound() throws ApiException, IOExcept
result = res;

App.getInstance();
times = 0;
result = Optional.of(app);
app.refreshOverlayIcon(localPath);
}};

final ExecutorMock executor = new ExecutorMock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public long getFileSize() {
return System.currentTimeMillis();
}
}, this.localPath);
DBMock.committed = false;

}

Expand Down