@@ -56,12 +56,7 @@ export class Console extends Runner {
5656 let result = new RunResult ( ) ;
5757 result . returnCode = 0 ;
5858
59- if ( this . platform == ConsolePlatform . WINDOWS ) {
60- let scriptsDir = path . join ( this . getWorkingDirectory ( ) , "devonfw" , "scripts" ) ;
61- this . executeCommandSync ( scriptsDir + "\\devon cobigen" , path . join ( this . getWorkingDirectory ( ) , "devonfw" ) , result ) ;
62- } else {
63- this . executeCommandSync ( "~/.devon/devon cobigen" , path . join ( this . getWorkingDirectory ( ) , "devonfw" ) , result ) ;
64- }
59+ this . executeDevonCommandSync ( "cobigen" , path . join ( this . getWorkingDirectory ( ) , "devonfw" ) , result ) ;
6560 return result ;
6661 }
6762
@@ -71,12 +66,7 @@ export class Console extends Runner {
7166
7267 let workspaceDir = path . join ( this . getWorkingDirectory ( ) , "devonfw" , "workspaces" , "main" ) ;
7368 let projectName = command . parameters [ 0 ] ;
74- if ( this . platform == ConsolePlatform . WINDOWS ) {
75- let scriptsDir = path . join ( this . getWorkingDirectory ( ) , "devonfw" , "scripts" ) ;
76- this . executeCommandSync ( scriptsDir + "\\devon java create com.example.application." + projectName , workspaceDir , result ) ;
77- } else {
78- this . executeCommandSync ( "~/.devon/devon java create com.example.application." + projectName , workspaceDir , result ) ;
79- }
69+ this . executeDevonCommandSync ( "java create com.example.application." + projectName , workspaceDir , result ) ;
8070
8171 return result ;
8272 }
@@ -105,12 +95,11 @@ export class Console extends Runner {
10595 let result = new RunResult ( ) ;
10696 result . returnCode = 0 ;
10797
108- let projectDir = path . join ( this . getWorkingDirectory ( ) , "devonfw" , "workspaces" , "main" , command . parameters [ 0 ] )
109- if ( this . platform == ConsolePlatform . WINDOWS ) {
110- let scriptsDir = path . join ( this . getWorkingDirectory ( ) , "devonfw" , "scripts" ) ;
111- this . executeCommandSync ( scriptsDir + "\\devon mvn clean install -Dmaven.test.skip=" + ! command . parameters [ 1 ] , projectDir , result ) ;
98+ let projectDir = path . join ( this . getWorkingDirectory ( ) , "devonfw" , "workspaces" , "main" , command . parameters [ 0 ] ) ;
99+ if ( command . parameters . length == 2 && command . parameters [ 1 ] == true ) {
100+ this . executeDevonCommandSync ( "mvn clean install" , projectDir , result ) ;
112101 } else {
113- this . executeCommandSync ( "~/.devon/devon mvn clean install -Dmaven.test.skip=" + ! command . parameters [ 1 ] , projectDir , result ) ;
102+ this . executeDevonCommandSync ( " mvn clean install -Dmaven.test.skip=true" , projectDir , result ) ;
114103 }
115104
116105 return result ;
@@ -121,12 +110,7 @@ export class Console extends Runner {
121110 result . returnCode = 0 ;
122111
123112 let workspaceDir = path . join ( this . getWorkingDirectory ( ) , "devonfw" , "workspaces" , "main" ) ;
124- if ( this . platform == ConsolePlatform . WINDOWS ) {
125- let scriptsDir = path . join ( this . getWorkingDirectory ( ) , "devonfw" , "scripts" ) ;
126- this . executeCommandSync ( scriptsDir + "\\devon cobigen generate " + command . parameters [ 0 ] , workspaceDir , result , command . parameters [ 1 ] . toString ( ) ) ;
127- } else {
128- this . executeCommandSync ( "~/.devon/devon cobigen generate " + command . parameters [ 0 ] , workspaceDir , result , command . parameters [ 1 ] . toString ( ) ) ;
129- }
113+ this . executeDevonCommandSync ( "cobigen generate " + command . parameters [ 0 ] , workspaceDir , result , command . parameters [ 1 ] . toString ( ) ) ;
130114
131115 return result ;
132116 }
@@ -203,4 +187,13 @@ export class Console extends Runner {
203187 result . returnCode = process . status ;
204188 }
205189 }
190+
191+ private executeDevonCommandSync ( devonCommand : string , directory : string , result : RunResult , input ?: string ) {
192+ if ( this . platform == ConsolePlatform . WINDOWS ) {
193+ let scriptsDir = path . join ( this . getWorkingDirectory ( ) , "devonfw" , "scripts" ) ;
194+ this . executeCommandSync ( scriptsDir + "\\devon " + devonCommand , directory , result , input ) ;
195+ } else {
196+ this . executeCommandSync ( "~/.devon/devon " + devonCommand , directory , result , input ) ;
197+ }
198+ }
206199}
0 commit comments