Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Georgie] iP #576

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
3b19ba1
Add Gradle support
May 24, 2020
e4b2de5
point to correct mainClassName
geoboom Aug 18, 2020
61b6dbd
design docs to track my thoughts
geoboom Aug 18, 2020
adaa469
implement basic echo and exit functionality
geoboom Aug 19, 2020
a96fe27
test commit
geoboom Aug 19, 2020
9349420
Merge pull request #2 from geoboom/development
geoboom Aug 19, 2020
0dc76f4
Add package support and Duke singleton for data access
geoboom Aug 20, 2020
54f32bd
Add input parser and runner
geoboom Aug 20, 2020
8cf3ad8
Rename Duke to Runner
geoboom Aug 20, 2020
f311f84
Rewrite test script to account for packages
geoboom Aug 20, 2020
5c28ae8
Add unit tests
geoboom Aug 20, 2020
210e7dd
Fix some logic
geoboom Aug 20, 2020
1b93bbe
Add some javadocs
geoboom Aug 20, 2020
203f933
Add task class
geoboom Aug 20, 2020
9a4753c
Make adjustments to accommodate Task class
geoboom Aug 20, 2020
3a0bf41
Add Commands as an abstraction to actions, following Command pattern
geoboom Sep 5, 2020
79efca0
Add CLI Observer to separate rendering of text from program logic
geoboom Sep 5, 2020
649cb22
Add Commands as abstraction
geoboom Sep 5, 2020
3a57b62
Use polymorphism for different task types
geoboom Sep 5, 2020
6d89193
Add exception class to handle parsing issues
geoboom Sep 5, 2020
f0a8f28
Update duke store to fit new implementation of program
geoboom Sep 5, 2020
ed89784
Update parser to return Command object on parsing string
geoboom Sep 5, 2020
a734e05
Update to use new implementation of classes and logic
geoboom Sep 5, 2020
1f9790d
Misc from testing
geoboom Sep 5, 2020
6f37b3e
Merge pull request #9 from geoboom/development
geoboom Sep 5, 2020
c1338b2
Add deleteTask
geoboom Sep 8, 2020
9f3dc2c
Add parsing of delete task and implement enums
geoboom Sep 8, 2020
b5a855c
Rename (refactor)
geoboom Sep 8, 2020
9879d0f
Add delete command
geoboom Sep 8, 2020
46cc08f
Add command enum
geoboom Sep 8, 2020
7581f27
Merge pull request #10 from geoboom/development
geoboom Sep 8, 2020
9566228
Add Storage
geoboom Sep 9, 2020
b026f49
Implement DateTime stuff
geoboom Sep 18, 2020
90fad9a
Merge pull request #11 from geoboom/branch-Level-7
geoboom Sep 18, 2020
fe5d344
Merge pull request #12 from geoboom/branch-Level-8
geoboom Sep 18, 2020
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
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>CS2103T-iP</name>
<comment>Project CS2103T-iP created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
13 changes: 13 additions & 0 deletions .settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
arguments=
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=/usr/lib/jvm/java-14-jdk
jvm.arguments=
offline.mode=false
override.workspace.settings=true
show.console.view=true
show.executions.view=true
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Duke project template
# duke.runner.Runner 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.

Expand All @@ -15,7 +15,7 @@ Prerequisites: JDK 11, update Intellij to the most recent version.
1. Click `Open or 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:
1. After the importing is complete, locate the `src/main/java/duke.runner.Runner.java` file, right-click it, and choose `Run duke.runner.Runner.main()`. If the setup is correct, you should see something like the below:
```
Hello from
____ _
Expand Down
46 changes: 46 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
plugins {
id 'java'
id 'application'
id 'checkstyle'
id 'com.github.johnrengelman.shadow' version '5.1.0'
}

repositories {
mavenCentral()
}

dependencies {
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.0'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.5.0'
}

test {
useJUnitPlatform()

testLogging {
events "passed", "skipped", "failed"

showExceptions true
exceptionFormat "full"
showCauses true
showStackTraces true
showStandardStreams = false
}
}

application {
mainClassName = "Runner"
}

shadowJar {
archiveBaseName = "duke"
archiveClassifier = null
}

checkstyle {
toolVersion = '8.23'
}

run{
standardInput = System.in
}
3 changes: 3 additions & 0 deletions data/data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
2 | NOT DONE | DEADLINE | testing | 12/10/1999 2359
3 | NOT DONE | EVENT | my name chef | 10/10/2021 1800
4 | NOT DONE | TODO | mynamechef
32 changes: 32 additions & 0 deletions design-docs/design-docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Week 2 (17 AUG - 23 AUG)

## Preliminary Design

The task is to build an extensible terminal chat application named duke.runner.Runner. Having some experience with Android, FullStack web development, and system design, I decided to glance over the future specs and enhancements and read up a bit about JavaFX FXML (the GUI library) before starting. This gives me a feel of the scope and scale of project duke.runner.Runner so I can choose an architectural pattern to roll with. For now, the MVVM (Model-View-ViewModel) pattern seems promising, along with a DAO (Data Access Object) to encapsulate communication with the data layer.

Since I like microservice architecture and modular applications a lot, my goal is to make the transition from CLI to GUI or file-based storage to DB-based storage as simple as "plug-n-play". Perhaps my design may evolve or change over the next few weeks. We'll see.

## Project Management

Just like in AGILE, project milestones are issued and checked in weekly sprints. This is nice because I plan to learn GitHub project board to manage the development process with Epics, User Stories, and issues.

## Gradle and JUnit

I think I'll start by migrating the project over to Gradle and conduct testing with JUnit 5 rather than running the `.sh` script over and over. I'll also use gradle to build the `.jar`. If I have time I might set up CircleCI/Travis CI pipeline to automatically test and build the `.jar` and release it using semantic versioning. This too is a great opportunity for me to practice TDD (Test-Driven Development) as well, where unit tests are written before the actual code.

## Packages

To be updated.

# Week 3 (24 AUG - 30 AUG)

```
August 2020
Mo Tu We Th Fr Sa Su
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
```
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
183 changes: 183 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn () {
echo "$*"
}

die () {
echo
echo "$*"
echo
exit 1
}

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi

# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option

if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

exec "$JAVACMD" "$@"
Loading