( rootDir: string, platformDir: any, nativeProjectDirAbs: string, )
| 426 | } |
| 427 | |
| 428 | async function determinePackageManager( |
| 429 | rootDir: string, |
| 430 | platformDir: any, |
| 431 | nativeProjectDirAbs: string, |
| 432 | ): Promise<PackageManager> { |
| 433 | if (existsSync(resolve(nativeProjectDirAbs, 'CapApp-SPM'))) { |
| 434 | return 'SPM'; |
| 435 | } |
| 436 | |
| 437 | if (process.env.CAPACITOR_COCOAPODS_PATH) { |
| 438 | return 'Cocoapods'; |
| 439 | } |
| 440 | |
| 441 | let gemfilePath = ''; |
| 442 | if (await pathExists(resolve(rootDir, 'Gemfile'))) { |
| 443 | gemfilePath = resolve(rootDir, 'Gemfile'); |
| 444 | } else if (await pathExists(resolve(platformDir, 'Gemfile'))) { |
| 445 | gemfilePath = resolve(platformDir, 'Gemfile'); |
| 446 | } else if (await pathExists(resolve(nativeProjectDirAbs, 'Gemfile'))) { |
| 447 | gemfilePath = resolve(nativeProjectDirAbs, 'Gemfile'); |
| 448 | } |
| 449 | |
| 450 | const appSpecificGemfileExists = gemfilePath != ''; |
| 451 | |
| 452 | // Multi-app projects might share a single global 'Gemfile' at the Git repository root directory. |
| 453 | if (!appSpecificGemfileExists) { |
| 454 | try { |
| 455 | const output = await getCommandOutput('git', ['rev-parse', '--show-toplevel'], { cwd: rootDir }); |
| 456 | if (output != null) { |
| 457 | gemfilePath = resolve(output, 'Gemfile'); |
| 458 | } |
| 459 | } catch (e: any) { |
| 460 | // Nothing |
| 461 | } |
| 462 | } |
| 463 | |
| 464 | try { |
| 465 | const gemfileText = (await readFile(gemfilePath)).toString(); |
| 466 | if (!gemfileText) { |
| 467 | return 'Cocoapods'; |
| 468 | } |
| 469 | const cocoapodsInGemfile = new RegExp(/gem\s+['"]cocoapods/).test(gemfileText); |
| 470 | |
| 471 | if (cocoapodsInGemfile && (await isInstalled('bundle'))) { |
| 472 | return 'bundler'; |
| 473 | } else { |
| 474 | return 'Cocoapods'; |
| 475 | } |
| 476 | } catch { |
| 477 | return 'Cocoapods'; |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | function formatConfigTS(extConfig: ExternalConfig): string { |
| 482 | // TODO: <reference> tags |
no test coverage detected