@@ -68,7 +68,7 @@ export class Console extends Runner {
6868 let result = new RunResult ( ) ;
6969 result . returnCode = 0 ;
7070
71- let workspaceDir = path . join ( this . getWorkingDirectory ( ) , "devonfw" , "workspaces" , "main" )
71+ let workspaceDir = path . join ( this . getWorkingDirectory ( ) , "devonfw" , "workspaces" , "main" ) ;
7272 let projectName = command . parameters [ 0 ] ;
7373 if ( this . platform == ConsolePlatform . WINDOWS ) {
7474 this . executeCommandSync ( "devon java create com.example.application." + projectName , workspaceDir , result ) ;
@@ -79,6 +79,26 @@ export class Console extends Runner {
7979 return result ;
8080 }
8181
82+ runCreateFile ( step : Step , command : Command ) : RunResult {
83+ let result = new RunResult ( ) ;
84+ result . returnCode = 0 ;
85+
86+ let workspaceDir = path . join ( this . getWorkingDirectory ( ) , "devonfw" , "workspaces" , "main" ) ;
87+ let filepath = path . join ( workspaceDir , command . parameters [ 0 ] ) ;
88+ if ( ! fs . existsSync ( filepath . substr ( 0 , filepath . lastIndexOf ( path . sep ) ) ) ) {
89+ fs . mkdirSync ( filepath . substr ( 0 , filepath . lastIndexOf ( path . sep ) ) , { recursive : true } ) ;
90+ }
91+
92+ let content = "" ;
93+ if ( command . parameters . length == 2 ) {
94+ content = fs . readFileSync ( path . join ( this . playbookPath , command . parameters [ 1 ] ) , { encoding : "utf-8" } ) ;
95+ }
96+ fs . writeFileSync ( filepath , content ) ;
97+
98+ return result ;
99+ }
100+
101+
82102 runBuildJava ( step : Step , command : Command ) : RunResult {
83103 let result = new RunResult ( ) ;
84104 result . returnCode = 0 ;
@@ -149,7 +169,12 @@ export class Console extends Runner {
149169 . fileExits ( path . join ( workspaceDir , command . parameters [ 0 ] , "core" , "src" , "main" , "java" , "com" , "example" , "application" , command . parameters [ 0 ] , "SpringBootApp.java" ) ) ;
150170 }
151171
152-
172+ async assertCreateFile ( step : Step , command : Command , result : RunResult ) {
173+ new Assertions ( )
174+ . noErrorCode ( result )
175+ . noException ( result )
176+ . fileExits ( path . join ( this . getWorkingDirectory ( ) , "devonfw" , "workspaces" , "main" , command . parameters [ 0 ] ) ) ;
177+ }
153178
154179 private executeCommandSync ( command : string , directory : string , result : RunResult , input ?: string ) {
155180 if ( result . returnCode != 0 ) return ;
0 commit comments