@@ -425,25 +425,34 @@ export class SysInfo implements NativeScriptDoctor.ISysInfo {
425425 ) ;
426426 const xcodeProjectDir = path . join ( tempDirectory , "cocoapods" ) ;
427427
428- // If ADSF version manager is installed, get the config for the project directory and write it to the temporary project directory
428+ // If asdf version manager is installed, get the current Ruby version for the project directory and write it to the temporary project directory
429429 const asdfResult = await this . childProcess . spawnFromEvent (
430430 "asdf" ,
431- [ "list " , "ruby" ] ,
431+ [ "current " , "ruby" ] ,
432432 "exit" ,
433- ) ;
434- const asdfVersionMatch = ( asdfResult . stdout as string ) . match (
435- SysInfo . VERSION_REGEXP ,
433+ { ignoreError : true } ,
436434 ) ;
437435
438- if ( asdfVersionMatch ?. [ 0 ] ) {
439- const asdfVersion = asdfVersionMatch [ 0 ] ;
440- const asdfConfigPath = path . join ( xcodeProjectDir , ".tool-versions" ) ;
441- const wroteASDFConfig = this . fileSystem . appendFile (
442- asdfConfigPath ,
443- `ruby ${ asdfVersion } ` ,
436+ if ( asdfResult . exitCode === 0 ) {
437+ const asdfVersionMatch = ( asdfResult . stdout as string ) . match (
438+ SysInfo . VERSION_REGEXP ,
444439 ) ;
445- if ( ! wroteASDFConfig ) {
446- console . warn ( `Cocoapods invocation may fail, check asdf config` ) ;
440+
441+ if ( asdfVersionMatch ?. [ 0 ] ) {
442+ const asdfVersion = asdfVersionMatch [ 0 ] ;
443+ const asdfConfigPath = path . join (
444+ xcodeProjectDir ,
445+ ".tool-versions" ,
446+ ) ;
447+ const wroteASDFConfig = this . fileSystem . appendFile (
448+ asdfConfigPath ,
449+ `ruby ${ asdfVersion } ` ,
450+ ) ;
451+ if ( ! wroteASDFConfig ) {
452+ console . warn (
453+ `CocoaPods invocation may fail, check asdf config` ,
454+ ) ;
455+ }
447456 }
448457 }
449458
0 commit comments