forked from nus-cs2103-AY2223S1/ip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
damithc
committed
May 24, 2020
1 parent
71d7ea8
commit ef3c8cd
Showing
6 changed files
with
95 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,6 @@ src/main/resources/docs/ | |
.DS_Store | ||
*.iml | ||
bin/ | ||
|
||
/text-ui-test/ACTUAL.txt | ||
text-ui-test/EXPECTED-UNIX.TXT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,26 @@ | ||
# Setting up | ||
|
||
**Prerequisites** | ||
|
||
* JDK 11 | ||
* Recommended: IntelliJ IDE | ||
* Fork this repo to your GitHub account and clone the fork to your computer | ||
|
||
**Importing the project into IntelliJ** | ||
|
||
1. Open IntelliJ (if you are not in the welcome screen, click `File` > `Close Project` to close the existing project dialog first). | ||
1. Set up the correct JDK version. | ||
* Click `Configure` > `Structure for new Projects` (in older versions of Intellij:`Configure` > `Project Defaults` > `Project Structure`). | ||
* If JDK 11 is listed in the drop down, select it. If it is not, click `New...` and select the directory where you installed JDK 11. | ||
* Click `OK`. | ||
1. Click `Import Project`. | ||
1. Locate the project directory and click `OK`. | ||
1. Select `Create project from existing sources` and click `Next`. | ||
1. Rename the project if you want. Click `Next`. | ||
1. Ensure that your src folder is checked. Keep clicking `Next`. | ||
1. Click `Finish`. | ||
|
||
# Tutorials | ||
|
||
Duke Increment | Tutorial | ||
---------------|--------------- | ||
`A-Gradle` | [Gradle Tutorial](tutorials/gradleTutorial.md) | ||
`A-TextUiTesting` | [Text UI Testing Tutorial](tutorials/textUiTestingTutorial.md) | ||
`Level-10` | JavaFX tutorials:<br>→ [Part 1: Introduction to JavaFX][fx1]<br>→ [Part 2: Creating a GUI for Duke][fx2]<br>→ [Part 3: Interacting with the user][fx3]<br>→ [Part 4: Introduction to FXML][fx4] | ||
|
||
[fx1]: <tutorials/javaFxTutorialPart1.md> | ||
[fx2]: <tutorials/javaFxTutorialPart2.md> | ||
[fx3]: <tutorials/javaFxTutorialPart3.md> | ||
[fx4]: <tutorials/javaFxTutorialPart4.md> | ||
|
||
# Feedback, Bug Reports | ||
|
||
* If you have feedback or bug reports, please post in [se-edu/duke issue tracker](https://github.com/se-edu/duke/issues). | ||
* We welcome pull requests too. | ||
# Duke project template | ||
|
||
This is a project template for a greenfield Java project. It's named after the Java mascot _Duke_. Given below are instructions on how to use it. | ||
|
||
## Setting up in Intellij | ||
|
||
Prerequisites: JDK 11, update Intellij to the most recent version. | ||
|
||
1. Open Intellij (if you are not in the welcome screen, click `File` > `Close Project` to close the existing project dialog first) | ||
1. Set up the correct JDK version, as follows: | ||
1. Click `Configure` > `Structure for New Projects` and then `Project Settings` > `Project` > `Project SDK` | ||
1. If JDK 11 is listed in the drop down, select it. If it is not, click `New...` and select the directory where you installed JDK 11 | ||
1. Click `OK` | ||
1. Import the project into Intellij as follows: | ||
1. Click `Open of Import`. | ||
1. Select the project directory, and click `OK` | ||
1. If there are any further prompts, accept the defaults. | ||
1. After the importing is complete, locate the `src/main/java/Duke.java` file, right-click it, and choose `Run Duke.main()`. If the setup is correct, you should see something like the below: | ||
``` | ||
Hello from | ||
____ _ | ||
| _ \ _ _| | _____ | ||
| | | | | | | |/ / _ \ | ||
| |_| | |_| | < __/ | ||
|____/ \__,_|_|\_\___| | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Hello from | ||
____ _ | ||
| _ \ _ _| | _____ | ||
| | | | | | | |/ / _ \ | ||
| |_| | |_| | < __/ | ||
|____/ \__,_|_|\_\___| | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@ECHO OFF | ||
|
||
REM create bin directory if it doesn't exist | ||
if not exist ..\bin mkdir ..\bin | ||
|
||
REM delete output from previous run | ||
del ACTUAL.TXT | ||
|
||
REM compile the code into the bin folder | ||
javac -cp ..\src -Xlint:none -d ..\bin ..\src\main\java\Duke.java | ||
IF ERRORLEVEL 1 ( | ||
echo ********** BUILD FAILURE ********** | ||
exit /b 1 | ||
) | ||
REM no error here, errorlevel == 0 | ||
|
||
REM run the program, feed commands from input.txt file and redirect the output to the ACTUAL.TXT | ||
java -classpath ..\bin Duke < input.txt > ACTUAL.TXT | ||
|
||
REM compare the output to the expected output | ||
FC ACTUAL.TXT EXPECTED.TXT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
|
||
# create bin directory if it doesn't exist | ||
if [ ! -d "../bin" ] | ||
then | ||
mkdir ../bin | ||
fi | ||
|
||
# delete output from previous run | ||
if [ -e "./ACTUAL.TXT" ] | ||
then | ||
rm ACTUAL.TXT | ||
fi | ||
|
||
# compile the code into the bin folder, terminates if error occurred | ||
if ! javac -cp ../src -Xlint:none -d ../bin ../src/main/java/Duke.java | ||
then | ||
echo "********** BUILD FAILURE **********" | ||
exit 1 | ||
fi | ||
|
||
# run the program, feed commands from input.txt file and redirect the output to the ACTUAL.TXT | ||
java -classpath ../bin Duke < input.txt > ACTUAL.TXT | ||
|
||
# convert to UNIX format | ||
cp EXPECTED.TXT EXPECTED-UNIX.TXT | ||
dos2unix ACTUAL.TXT EXPECTED-UNIX.TXT | ||
|
||
# compare the output to the expected output | ||
diff ACTUAL.TXT EXPECTED-UNIX.TXT | ||
if [ $? -eq 0 ] | ||
then | ||
echo "Test result: PASSED" | ||
exit 0 | ||
else | ||
echo "Test result: FAILED" | ||
exit 1 | ||
fi |