Skip to content

Commit

Permalink
Test jar
Browse files Browse the repository at this point in the history
  • Loading branch information
A1WAYSD committed Sep 20, 2023
1 parent 83e6d19 commit 1461bb9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
6 changes: 2 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,11 @@ test {
}

application {
mainClass.set("duke.Duke")
mainClass.set("duke.Launcher")
}

shadowJar {
archiveBaseName = "duke"
archiveClassifier = null
dependsOn("distZip", "distTar")
archiveFileName = 'L.jar'
}

run{
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/duke/Duke.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class Duke {
*/
public Duke(Stage stage) {
this.stage = stage;
storage = new Storage("data/duke.txt");
storage = new Storage();
tasks = new TaskList();
try {
tasks.addTasks(storage.loadFile());
Expand All @@ -41,7 +41,7 @@ public String getResponse(String input) {
try {
String output = parser.parse(input);
if (!parser.isRunning()) {
exit();
return exit();
}
return output;
} catch (DukeException e) {
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/duke/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
* Represents a storage that loads tasks from the specified file and saves tasks to the same file.
*/
public class Storage {
private final String filePath;
private static final String FILE_PATH = "data/duke.txt";

public Storage(String filePath) {
this.filePath = filePath;
public Storage() {
}

/**
Expand All @@ -36,9 +35,9 @@ public void save(TaskList taskList) throws IOException {
return;
}
assert !txt.isEmpty() : "tasks.txt should not be empty";
new File(filePath).createNewFile();
assert new File(filePath).exists() : "tasks.txt should exist";
FileWriter fw = new FileWriter(filePath);
new File(FILE_PATH).createNewFile();
assert new File(FILE_PATH).exists() : "tasks.txt should exist";
FileWriter fw = new FileWriter(FILE_PATH);
fw.write(taskList.getTasksTxt());
fw.close();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/duke/gui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private void handleUserInput() {
userInput.clear();
if (response.equals(BYE_MSG)) {
// Close the window after 5 seconds
PauseTransition pause = new PauseTransition(Duration.seconds(5));
PauseTransition pause = new PauseTransition(Duration.seconds(3));
pause.setOnFinished(event -> duke.close());
pause.play();
}
Expand Down

0 comments on commit 1461bb9

Please sign in to comment.