Skip to content

Commit cc99151

Browse files
authored
Merge pull request #32 from denise-khuu/feature/createproject
Feature/createproject
2 parents 6144899 + 1551bde commit cc99151

File tree

16 files changed

+196
-12
lines changed

16 files changed

+196
-12
lines changed

buildRun.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ Copy-Item -Force -Recurse -Path $PSScriptRoot\engine\parser.def -Destination $PS
33
Copy-Item -Force -Recurse -Path $PSScriptRoot\playbooks\ -Destination $PSScriptRoot\build
44
Copy-Item -Force -Recurse -Path $PSScriptRoot\environments\ -Destination $PSScriptRoot\build
55
Copy-Item -Force -Recurse -Path $PSScriptRoot\runners\ -Destination $PSScriptRoot\build
6+
npm test
67
node $PSScriptRoot\build\engine\run.js

buildRun.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ cp engine/parser.def build/engine/parser.def
33
cp -r playbooks build
44
cp -r environments build
55
cp -r runners build
6+
npm test
67
node build/engine/run.js

localBuildRun.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ Copy-Item -Force -Recurse -Path $PSScriptRoot\engine\parser.def -Destination $PS
33
Copy-Item -Force -Recurse -Path $PSScriptRoot\..\tutorials -Destination $PSScriptRoot\build\playbooks
44
Copy-Item -Force -Recurse -Path $PSScriptRoot\environments\ -Destination $PSScriptRoot\build
55
Copy-Item -Force -Recurse -Path $PSScriptRoot\runners\ -Destination $PSScriptRoot\build
6+
npm test
7+
if(-not $?) { throw 'tests failed' }
68
node $PSScriptRoot\build\engine\run.js

localBuildRun.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,9 @@ cp engine/parser.def build/engine/parser.def
33
cp -r ../tutorials build/playbooks
44
cp -r environments build
55
cp -r runners build
6+
npm test
7+
if [ $? -eq 1 ]; then
8+
echo 'tests failed'
9+
exit 1
10+
fi
611
node build/engine/run.js

localBuildTest.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tsc
2+
npm test
3+
if(-not $?){ throw 'tests failed' }

localBuildTest.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
tsc
2+
npm test
3+
if [ $? -eq 1 ]; then
4+
echo 'tests failed'
5+
exit 1
6+
fi

package-lock.json

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
"ts-pegjs": "^0.2.7",
1212
"yargs": "^16.1.0"
1313
},
14-
"devDependencies": {},
14+
"devDependencies": {
15+
"@types/jasmine": "^3.6.2",
16+
"jasmine": "^3.6.2"
17+
},
1518
"scripts": {
16-
"test": "echo \"Error: no test specified\" && exit 1"
19+
"test": "npx jasmine"
1720
},
1821
"author": "",
1922
"license": "ISC"

runners/console/index.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@ export class Console extends Runner {
9797
return null;
9898
}
9999

100-
runBuildJava(step: Step, command: Command): RunResult {
101-
return null;
102-
}
103-
104100
async assertInstallDevonfwIde(step: Step, command: Command, result: RunResult) {
105101
let installedTools = command.parameters[0];
106102

@@ -153,9 +149,6 @@ export class Console extends Runner {
153149
.fileExits(path.join(workspaceDir, command.parameters[0], "core", "src", "main", "java", "com", "example", "application", command.parameters[0], "SpringBootApp.java"));
154150
}
155151

156-
async assertbuildJava(step: Step, command: Command, result: RunResult) {
157-
console.log("assertbuildJava exceptions");
158-
}
159152

160153

161154
private executeCommandSync(command: string, directory: string, result: RunResult, input?: string) {

runners/katacoda/dirUtils.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import * as path from 'path';
2+
3+
export class DirUtils{
4+
5+
getCdParam(currentDir:string, targetDir:string):string{
6+
7+
//returns an empty string, if both variables have the same path
8+
if(currentDir == targetDir){
9+
return "";
10+
}
11+
12+
let dirPath = "";
13+
14+
let currentPaths = currentDir.split(path.sep);
15+
let targetPaths = targetDir.split(path.sep);
16+
17+
let index;
18+
let isEqual = true;
19+
20+
//saves the remaining path, if currentdir is the prefix of targetDir
21+
if(targetDir.substring(0,currentDir.length) == currentDir){
22+
return path.join(targetDir.replace(currentDir + path.sep, '')).replace("\\", "/");
23+
}
24+
25+
26+
else{
27+
//returns the absolut directory, if the first parent folder is different
28+
if(currentPaths[1] != targetPaths[1]){
29+
return targetDir.replace("\\", "/");
30+
}
31+
32+
//iterates throught currentPath array to compare parent directories
33+
currentPaths.forEach((currentPath, i) => {
34+
if(currentPath == targetPaths[i] && isEqual == true){
35+
index = i;
36+
}else{
37+
isEqual = false;
38+
dirPath = path.join(dirPath,'..');
39+
}
40+
})
41+
42+
//slice targetPaths to get the relative path
43+
targetPaths = targetPaths.slice(index + 1, targetPaths.length);
44+
45+
return path.join(dirPath, targetPaths.join(path.sep)).replace("\\", "/");
46+
47+
}
48+
49+
}
50+
51+
}

0 commit comments

Comments
 (0)