Skip to content
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
9 changes: 9 additions & 0 deletions assertions/directoryNotEmpty.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as fs from "fs";

export class DirectoryNotEmpty {
public static run(directory: string): void {
if(fs.readdirSync(directory).length == 0) {
throw new Error("directory " + directory + " is empty");
}
}
}
6 changes: 6 additions & 0 deletions assertions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { NoErrorCode } from "./noErrorCode";
import { NoException } from "./noException";
import { DirectoryExist } from "./directoryExist";
import { FileExist } from "./fileExist";
import { DirectoryNotEmpty } from "./directoryNotEmpty";


export class Assertions {
Expand All @@ -24,6 +25,11 @@ export class Assertions {
return this;
}

public directoryNotEmpty(directory: string): Assertions {
DirectoryNotEmpty.run(directory);
return this;
}

public fileExits(filepath: string): Assertions {
FileExist.run(filepath);
return this;
Expand Down
2 changes: 1 addition & 1 deletion documentation/Functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ cobiGenJava("path/to/java/file/MyEntity.java",[1,3,5,6,8])

### createDevon4jProject
#### parameter
1. the project name
1. The project name
#### example
createDevon4jProject("cobigenexample")

Expand Down
2 changes: 1 addition & 1 deletion runners/console/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class Console extends Runner {
}

async assertCobiGenJava(step: Step, command: Command, result: RunResult) {
console.log("assertCobiGenJava");
console.log("there is no assertion yet for the cobiGenJava command");
}

async assertCreateDevon4jProject(step: Step, command: Command, result: RunResult) {
Expand Down