@@ -22,6 +22,7 @@ export class Katacoda extends Runner {
2222 private setupDir : string ;
2323 private currentDir : string = path . join ( "/root" ) ;
2424 private terminalCounter : number = 1 ;
25+ private showVsCodeIde : boolean = false ;
2526 private terminals : KatacodaTerminals [ ] = [ { function : "default" , terminalId : 1 } ] ;
2627
2728 init ( playbook : Playbook ) : void {
@@ -68,13 +69,14 @@ export class Katacoda extends Runner {
6869 this . assetManager . copyAssets ( ) ;
6970
7071 // write index file, required for katacoda to load the tutorial
71- let indexJsonObject = KatacodaTools . generateIndexJson ( playbook . title , ( ( this . stepsCount ) * 5 ) , this . steps , this . assetManager . getKatacodaAssets ( ) ) ;
72+ let indexJsonObject = KatacodaTools . generateIndexJson ( playbook . title , ( ( this . stepsCount ) * 5 ) , this . steps , this . assetManager . getKatacodaAssets ( ) , this . showVsCodeIde ) ;
7273 fs . writeFileSync ( this . outputPathTutorial + 'index.json' , JSON . stringify ( indexJsonObject , null , 2 ) ) ;
7374 }
7475
7576 runInstallDevonfwIde ( runCommand : RunCommand ) : RunResult {
7677 let cdCommand = this . changeCurrentDir ( path . join ( "/root" ) ) ;
7778 let tools = runCommand . command . parameters [ 0 ] . join ( " " ) . replace ( / v s c o d e / , "" ) . replace ( / e c l i p s e / , "" ) . trim ( ) ;
79+ if ( runCommand . command . parameters [ 0 ] . indexOf ( "vscode" ) > - 1 ) this . showVsCodeIde = true ;
7880
7981 // create script to download devonfw ide settings
8082 this . renderTemplate ( path . join ( "scripts" , "cloneDevonfwIdeSettings.sh" ) , path . join ( this . setupDir , "cloneDevonfwIdeSettings.sh" ) , { tools : tools , cloneDir : "/root/devonfw-settings/" } ) ;
@@ -102,6 +104,7 @@ export class Katacoda extends Runner {
102104
103105 runRestoreDevonfwIde ( runCommand : RunCommand ) : RunResult {
104106 let tools = runCommand . command . parameters [ 0 ] . join ( " " ) . replace ( / v s c o d e / , "" ) . replace ( / e c l i p s e / , "" ) . trim ( ) ;
107+ if ( runCommand . command . parameters [ 0 ] . indexOf ( "vscode" ) > - 1 ) this . showVsCodeIde = true ;
105108
106109 // create script to download devonfw ide settings.
107110 this . renderTemplate ( path . join ( "scripts" , "cloneDevonfwIdeSettings.sh" ) , path . join ( this . setupDir , "cloneDevonfwIdeSettings.sh" ) , { tools : tools , cloneDir : "/root/devonfw-settings/" } ) ;
@@ -137,14 +140,16 @@ export class Katacoda extends Runner {
137140 let params = runCommand . command . parameters ;
138141 let cobiGenTemplates = params [ 1 ] . join ( "," ) ;
139142
140- this . renderTemplate ( path . join ( "scripts" , "installCobiGenPlugin.sh" ) , path . join ( this . setupDir , "installCobiGenPlugin.sh" ) , { } ) ;
141- this . setupScripts . push ( {
142- "name" : "Install CobiGen plugin" ,
143- "script" : "installCobiGenPlugin.sh"
144- } ) ;
143+ if ( this . showVsCodeIde ) {
144+ this . renderTemplate ( path . join ( "scripts" , "installCobiGenPlugin.sh" ) , path . join ( this . setupDir , "installCobiGenPlugin.sh" ) , { } ) ;
145+ this . setupScripts . push ( {
146+ "name" : "Install CobiGen plugin" ,
147+ "script" : "installCobiGenPlugin.sh"
148+ } ) ;
149+ }
150+
145151 this . pushStep ( runCommand , "CobiGen Java" , "step" + this . getStepsCount ( runCommand ) + ".md" ) ;
146-
147- this . renderTemplate ( "cobiGenJava.md" , this . outputPathTutorial + "step" + this . stepsCount + ".md" , { text : runCommand . text , textAfter : runCommand . textAfter , javaFile : params [ 0 ] , cobiGenTemplates : cobiGenTemplates } ) ;
152+ this . renderTemplate ( "cobiGenJava.md" , this . outputPathTutorial + "step" + this . stepsCount + ".md" , { text : runCommand . text , textAfter : runCommand . textAfter , javaFile : params [ 0 ] , cobiGenTemplates : cobiGenTemplates , useVsCode : this . showVsCodeIde } ) ;
148153 return null ;
149154
150155 }
0 commit comments