Skip to content

Commit c675ac1

Browse files
committed
Merge branch 'master' of http://github.com/matyb/java-koans into noninteractive
2 parents 2bc8a16 + 3e1d7bd commit c675ac1

4 files changed

Lines changed: 12 additions & 13 deletions

File tree

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@ https://github.com/matyb/java-koans/archive/master.zip
88
```cd <the directory you just unarchived>```
99
* Within it you'll find:
1010
* *koans*: this directory contains the application and its lessons, it is all that is needed to advance through the koans themselves and **it can be distributed independently**
11-
* *lib/koans-lib*: the directory for source code for the engine that executes the koans
12-
* *lib/koans-tests*: the directory for tests to check the sanity of the application
13-
* *lib/file-compiler*: the dynamic compiler module that loads newly saved java files into the JVM as classes
14-
* *lib/file-monitor*: the file monitoring module for notifying the app when files are saved
15-
* *lib/util*: application agnostic interfaces and utilities shared in projects
11+
* *lib*: this directory contains the code the koans engine is comprised of and built with
12+
* *gradle*: wrapper for build library used to build koans source, setup project files in eclipse/idea, run tests, etc. you probably don't need to touch anything in here
1613
* Change directory to the koans directory: ```cd koans```
17-
* If you are using windows enter: ```run.bat``` or ```./run.sh``` if you are using Mac or Linux.
14+
* If you are using windows enter: ```run.bat``` or ```./run.sh``` if you are using Mac or Linux
1815

1916
Developing a Koan:
2017
==================

koans/app/lib/koans.jar

76 Bytes
Binary file not shown.

lib/src/main/java/com/sandwich/koan/runner/AppLauncher.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void run() {
2929
char c = (char) System.in.read();
3030
char exitChar = ApplicationSettings.getExitChar();
3131
if (Character.toUpperCase(c) == Character.toUpperCase(exitChar)) {
32-
exit();
32+
exit(0);
3333
}
3434
} catch (IOException e) {
3535
throw new RuntimeException(e);
@@ -58,14 +58,11 @@ public void run() {
5858
ApplicationUtils.getPresenter().displayMessage(
5959
argsBuilder.toString());
6060
}
61-
if (!ApplicationSettings.isInteractive()) {
62-
exit();
63-
}
6461
}
6562

66-
private static void exit() {
63+
static void exit(int status) {
6764
FileMonitorFactory.closeAll();
68-
System.exit(0);
65+
System.exit(status);
6966
}
7067

7168
}

lib/src/main/java/com/sandwich/koan/runner/RunKoans.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.util.Map;
1010
import java.util.Map.Entry;
1111

12+
import com.sandwich.koan.ApplicationSettings;
1213
import com.sandwich.koan.Koan;
1314
import com.sandwich.koan.KoanClassLoader;
1415
import com.sandwich.koan.KoanMethod;
@@ -43,7 +44,11 @@ public RunKoans(Path pathToEnlightenment){
4344

4445
public void run(String... values) {
4546
ApplicationUtils.getPresenter().clearMessages();
46-
ApplicationUtils.getPresenter().displayResult(runKoans());
47+
KoanSuiteResult result = runKoans();
48+
ApplicationUtils.getPresenter().displayResult(result);
49+
if (!ApplicationSettings.isInteractive()) {
50+
AppLauncher.exit(result.getTotalNumberOfKoans() - result.getNumberPassing());
51+
}
4752
}
4853

4954
KoanSuiteResult runKoans() {

0 commit comments

Comments
 (0)