Skip to content

Commit

Permalink
feat(cli): Add configurable pod path (#3811)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasvidas authored Nov 17, 2020
1 parent 6162d07 commit 88f9187
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
10 changes: 10 additions & 0 deletions cli/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ async function loadIOSConfig(
cliConfig: CLIConfig,
): Promise<IOSConfig> {
const name = 'ios';
const podPath = determineCocoapodPath();
const platformDir = extConfig.ios?.path ?? 'ios';
const platformDirAbs = resolve(rootDir, platformDir);
const webDir = 'public';
Expand All @@ -211,6 +212,7 @@ async function loadIOSConfig(
templateDir: resolve(cliConfig.assetsDir, templateName),
pluginsDir: resolve(cliConfig.assetsDir, pluginsFolderName),
},
podPath,
};
}

Expand Down Expand Up @@ -279,3 +281,11 @@ async function determineAndroidStudioPath(os: OS): Promise<string> {

return '';
}

function determineCocoapodPath(): string {
if (process.env.CAPACITOR_COCOAPODS_PATH) {
return process.env.CAPACITOR_COCOAPODS_PATH;
}

return 'pod';
}
1 change: 1 addition & 0 deletions cli/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export interface AndroidConfig extends PlatformConfig {

export interface IOSConfig extends PlatformConfig {
readonly minVersion: string;
readonly podPath: string;
readonly cordovaSwiftVersion: string;
readonly webDir: string;
readonly webDirAbs: string;
Expand Down
2 changes: 1 addition & 1 deletion cli/src/ios/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export async function checkIOSPackage(config: Config): Promise<string | null> {
}

export async function checkCocoaPods(config: Config): Promise<string | null> {
if (!(await isInstalled('pod')) && config.cli.os === OS.Mac) {
if (!(await isInstalled(config.ios.podPath)) && config.cli.os === OS.Mac) {
return (
`CocoaPods is not installed.\n` +
`See this install guide: ${c.strong(
Expand Down
6 changes: 4 additions & 2 deletions cli/src/ios/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ export async function installCocoaPodsPlugins(
deployment: boolean,
): Promise<void> {
await runTask(
`Updating iOS native dependencies with ${c.input('pod install')}`,
`Updating iOS native dependencies with ${c.input(
`${config.ios.podPath} install`,
)}`,
() => {
return updatePodfile(config, plugins, deployment);
},
Expand Down Expand Up @@ -100,7 +102,7 @@ async function updatePodfile(
await remove(podfileLockPath);
}
await runCommand(
'pod',
config.ios.podPath,
['install', ...(deployment ? ['--deployment'] : [])],
{ cwd: projectRoot },
);
Expand Down

0 comments on commit 88f9187

Please sign in to comment.