Skip to content

Commit d85ce6c

Browse files
committed
also try bundle install
1 parent cf62b88 commit d85ce6c

File tree

1 file changed

+15
-5
lines changed
  • packages/cli-config-apple/src/tools

1 file changed

+15
-5
lines changed

packages/cli-config-apple/src/tools/pods.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,25 @@ export default async function resolvePods(
219219

220220
export async function execaPod(args: string[], options?: execa.Options) {
221221
let podType: 'system' | 'bundle' = 'system';
222+
222223
try {
224+
// try bundle pod first
223225
await execa('bundle', ['exec', 'pod', '--version'], options);
224226
podType = 'bundle';
225-
} catch (bundledPodError) {
227+
} catch (bundlePodError) {
228+
// try to install bundle pod
226229
try {
227-
await execa('pod', ['--version'], options);
228-
podType = 'system';
229-
} catch (systemPodError) {
230-
throw new Error('cocoapods not installed');
230+
await execa('bundle', ['install']);
231+
await execa('bundle', ['exec', 'pod', '--version'], options);
232+
podType = 'bundle';
233+
} catch (bundleInstallError) {
234+
// fall back to system pod
235+
try {
236+
await execa('pod', ['--version'], options);
237+
podType = 'system';
238+
} catch (systemPodError) {
239+
throw new Error('cocoapods not installed');
240+
}
231241
}
232242
}
233243

0 commit comments

Comments
 (0)